You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Amit Shah <am...@gmail.com> on 2016/04/20 09:26:54 UTC

Phoenix Bulk Load With Column Overrides

Hello,

I am using phoenix 4.6 and trying to bulk load data into a table from a csv
file using the psql.py utility. How do I map the table columns to the
header values in the csv file through the "-h" argument?

For e.g. Assume my phoenix table does not match the columns in the csv. The
phoenix table looks like this

CREATE TABLE PRODUCT(
PRODUCT_ID BIGINT NOT NULL
,PRODUCT_CLASS_ID BIGINT
,BRAND_NAME VARCHAR
,PRODUCT_NAME VARCHAR
,CONSTRAINT pk PRIMARY KEY (PRODUCT_ID)
);

while the csv has lot of other columns for e.g.
product_class_id,product_id,brand_name,product_name,SKU,SRP,gross_weight,net_weight

Note the order of the columns is also different. Execute the utility with
the below arguments fails with an error "Don't know how to interpret
argument 'brand_name,'

python psql.py -t PRODUCT -h product_class_id, product_id, brand_name,
product_name localhost product.csv

How can I fix this?

Thanks,
Amit

Re: Phoenix Bulk Load With Column Overrides

Posted by James Taylor <ja...@apache.org>.
Note that it's case sensitive, so try upper casing your column names in
your psql.py call.

On Wednesday, April 20, 2016, Amit Shah <am...@gmail.com> wrote:

> Hello,
>
> I am using phoenix 4.6 and trying to bulk load data into a table from a
> csv file using the psql.py utility. How do I map the table columns to the
> header values in the csv file through the "-h" argument?
>
> For e.g. Assume my phoenix table does not match the columns in the csv.
> The phoenix table looks like this
>
> CREATE TABLE PRODUCT(
> PRODUCT_ID BIGINT NOT NULL
> ,PRODUCT_CLASS_ID BIGINT
> ,BRAND_NAME VARCHAR
> ,PRODUCT_NAME VARCHAR
> ,CONSTRAINT pk PRIMARY KEY (PRODUCT_ID)
> );
>
> while the csv has lot of other columns for e.g.
>
> product_class_id,product_id,brand_name,product_name,SKU,SRP,gross_weight,net_weight
>
> Note the order of the columns is also different. Execute the utility with
> the below arguments fails with an error "Don't know how to interpret
> argument 'brand_name,'
>
> python psql.py -t PRODUCT -h product_class_id, product_id, brand_name,
> product_name localhost product.csv
>
> How can I fix this?
>
> Thanks,
> Amit
>