mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-07 23:07:00 +02:00
|
||
---|---|---|
.. | ||
clob | ||
cluttered | ||
csv | ||
errors | ||
partial | ||
serial | ||
simple | ||
udc | ||
pgloader.conf | ||
README |
In this directory you'll find out some pgloader usage examples. To use them, please first create a pgloader database, then for each example the tables it needs, then issue the pgloader command: $ createdb --encoding=utf-8 pgloader $ cd examples $ psql pgloader < simple/simple.sql $ ../pgloader.py -Tvc examples/pgloader.conf simple If you want to load data from all examples, create tables for all of them first, then run pgloader without argument. The provided examples are: . simple This dataset shows basic case, with trailing separator and data reordering. . errors Same test, but with impossible dates. Should report some errors. If it does not report errors, check you're not using psycopg 1.1.21. Should report 3 errors out of 7 lines (4 updates). . clob This dataset shows some text large object importing to PostgreSQL text datatype. . cluttured A dataset with newline escaped and multi-line input (without quoting) Beware of data reordering, too. . csv A dataset with csv delimiter ',' and quoting '"'. . partial A dataset from which we only load some columns of the provided one. . serial In this dataset the id field is ommited, it's a serial which will be automatically set by PostgreSQL while COPYing. . reformat A timestamp column is formated the way MySQL dump its timestamp, which is not the same as the way PostgreSQL reads them. The reformat.mysql module is used to reformat the data on-the-fly. . udc A used defined column test, where all file columns are not used but a new constant one, not found in the input datafile, is added while loading data. You can launch all those pgloader tests in one run, provided you created the necessary tables: $ for sql in */*sql; do psql pgloader < $sql; done $ ../pgloader.py -Tsc pgloader.conf [...] Table name | duration | size | copy rows | errors ==================================================================== clob | 0.043s | 32 kB | 7 | 0 cluttered | 0.032s | 32 kB | 6 | 0 csv | 0.031s | 16 kB | 6 | 0 errors | 0.030s | 32 kB | 4 | 3 partial | 0.078s | 32 kB | 7 | 0 reformat | 0.018s | 24 kB | 4 | 1 serial | 0.024s | 32 kB | 7 | 0 simple | 0.024s | 32 kB | 7 | 0 udc | 0.018s | 32 kB | 5 | 0 ==================================================================== Total | 0.298s | 264 kB | 53 | 4 Please note errors test should return 3 errors and reformat 1 error.