Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

command line utility for importing XML, JSON, BYTEA document to PostgreSQL

License

NotificationsYou must be signed in to change notification settings

okbob/pgimportdoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

command line utility for importing XML, JSON, BYTEA document to PostgreSQL

This PostgreSQL command line utility (extension) is used for importing XML, any text orbinary documents to PostgreSQL.

pgimportdoc -c 'insert into xmltab(x) values($1)' -t XML -f myxmldoc

for help run

pgimportdoc --help

XML documents are read in binary format - if XML doc has a header with encoding, then Postgresensures encoding from XML encoding to PostgreSQL encoding.

Text documents are read in text format - there are translation from client encoding toPostgreSQL server encoding.

When format is BYTEA, then passing data are in bytea escaped text format.

Attention: The imported documents are completly loaded to client's memory. So you need enough freememory on client, when you would to use this tool. Maximal teoretical size of imported documentis 1GB. More practical real maximal size is about 100MB.

ToDo:

  • More input files support - options -f1 xxx -f2 xxx ... insert into .. values( $1, $2 )
  • using LO API for passing binary data
  • regress tests

Examples:

[pavel@localhost ]$ ./pgimportdoc postgres -f ~/Stažené/enprimeur.xml -c 'insert into xmldata values($1)' -t XML[pavel@localhost ]$ cat ~/Stažené/enprimeur.xml | ./pgimportdoc postgres -c 'insert into xmldata values($1)' -t XML[pavel@localhost ]$ cat ~/Stažené/enprimeur.xml | ./pgimportdoc postgres -E latin2 -c 'insert into doc values($1) returning id' -t TEXT

Pavel Stehule, 2017pavel.stehule@gmail.com Czech Republic, Prague

About

command line utility for importing XML, JSON, BYTEA document to PostgreSQL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp