csv - How to import missing values in postgresql table -


my csv file has missing entries denoted -

1.2e+09 8.59e+09    in  3   480 5697277130  822277190   ok  1   0   1.23e+09    34295 4.89e+09    9.59e+09    out 3   480 1677272449  6747272509  ok  1   -100    8.87e+09    21 2.33e+09    4.49e+09    in  4   640 4347277310  4567277370  ok  1   -   3.23e+09    123  2.33e+09   4.49e+09        4   640 4347277310  4567277370  ok  1   -   3.23e+09     

i have defined table schema follows

create table zip_codes(   source numeric,   manual numeric,   ttype varchar,    feature1 numeric,    feature2 numeric,    lbp1 numeric,    rlbp numeric,    status varchar,    number_of_trasverse numeric,    rank numeric,    image_number numeric,    parent_class numeric); 

and import script csv file is

test_db=# copy zip_codes 'c:/tmp/dd_1.csv' delimiter ',' csv; 

my error:

error: invalid input syntax type numeric: "-"

context: copy zip_codes, line 7, column rank: "-"

should change numeric schema of rank else - values imported? suggestions on how can these values imported.

it large csv there way can import (-) values? suggestions?

any suggestions?

thanks!

you can specify string used denote null value. default, \n can use string, per doc, using option null 'null_string'. similar to

test_db=# copy zip_codes 'c:/tmp/dd_1.csv' delimiter ',' null '-' csv; 

should have valid negative values, may have play string (with tab, comma or else), or completly change way denote nulls.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -