Skip to content

gma2th/csvpsql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csvpsql

csvpsql generate Postgres table from csv file.

Installation

cargo install csvpsql

Usage

USAGE:
    csvpsql [FLAGS] [OPTIONS] --table-name <table-name> [file]

FLAGS:
        --drop          To drop the table if exists
    -h, --help          Prints help information
        --no-copy       To remove copy command
        --no-header     Whenever the csv file has no header
    -V, --version       Prints version information

OPTIONS:
    -c, --columns <columns>          Override column name. Separated by comma. Use the csv header or letters by default.
    -d, --delimiter <delimiter>       [default: ,]
    -n, --null-as <null-as>          Empty string are null by default [default: ]
    -t, --table-name <table-name>    File name is used as default

ARGS:
    <file>

Example

$ csvpsql --drop example.csv
drop table if exists example;

create table example (
   city text not null,
   region text not null,
   country text not null,
   population integer not null
);

\copy example from 'example.csv' with csv delimiter ',' header;

About

Generate Postgres table from csv file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages