Code Monkey home page Code Monkey logo

pgimportdoc's Introduction

pgimportdoc

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

This PostgreSQL command line utility (extension) is used for importing XML, any text or binary 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 Postgres ensures encoding from XML encoding to PostgreSQL encoding.

Text documents are read in text format - there are translation from client encoding to PostgreSQL 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 free memory on client, when you would to use this tool. Maximal teoretical size of imported document is 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, 2017 [email protected] Czech Republic, Prague

pgimportdoc's People

Contributors

okbob avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.