从CSV复制到SQL时数据丢失

时间:2019-01-28 21:09:08

标签: python python-3.x vertica

我正在使用Vertica Python将数据从csv文件复制到Vertica上的表。尽管运行速度非常快,但我丢失了大约700行数据。我试图删除csv文件并从新的csv文件加载,但是我面临着同样的问题。有人可以告诉我我在代码中做错了什么吗?

class Submit extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    const { enableButton } = this.props;

    return (
      <button type="button" disabled={!enableButton}>
        Hello world!
      </button>
    );
  }
}

class Input extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      name: "",
      address: ""
    };
  }

  handleChange = e => {
    const { enable } = this.props;
    const id = e.target.id;
    const value = e.target.value;

    this.setState({
      [id]: value
    });

    enable(id, value);
  };

  render() {
    const { myName } = this.state;

    console.log("Input:", this.state);

    return (
      <div>
        <input
          type="text"
          id="name"
          onChange={this.handleChange}
          placeholder=""
          {/* Always provide state values to your inputs to make sure they're always synchronized */}
          value={this.state.name}
        />
        <input
          type="text"
          id="address"
          onChange={this.handleChange}
          placeholder=""
          value={this.state.address}
        />
      </div>
    );
  }
}

class Parent extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      enableButton: false,
      inputFieldValues: {}
    };
  }

  enable = (key, value) => {
    const { inputFieldValues } = this.state;
    // Copy objects, when you change their fields.
    let changes = { ...inputFieldValues } || {};

    changes[key] = value;

    this.setState({
      enableButton: true,
      inputFieldValues: changes
    });
  };

  render() {
    const { enableButton } = this.state;

    console.log("Parent:", this.state);

    return (
      <div>
        <Input enable={this.enable} />
        <Submit enableButton={enableButton} />
      </div>
    );
  }
}

ReactDOM.render(<Parent />, document.getElementById("root"));

代码中有什么让我从csv文件中丢失数百行吗?

1 个答案:

答案 0 :(得分:2)

您可以使用REJECTED DATA和EXCEPTIONS找出缺少的行以及原因。您需要为每个路径指定一个路径。拒绝的数据将显示未复制的行,异常将显示错误的原因。

void getFolderID(nama){ //nama could be 1951 or 1955 or 1961....
int j=1950; // to get folder_id from 1951-2015
int folder_id=nama-j;
// write your query as desired below
}