Skip to content

ppKrauss/sql-loadPack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sql-loadPack

Use OKFN's tabular-data-package standard JSON descriptors to load dataset into SQL database, and option to express fields in JSONB. Use faster internal SQL COPY (or BULK INSERT).

There are no necessary preparation, use the prefered source file in your software, eg. src/packLoad.php.

NOTE. Similar to okfn/dptools/load-postgresql.py, but with important JSON field option.

Preparing examples

To illustrate packLoad use with PHP in PostgreSQL 9.5+

git clone https://github.com/ppKrauss/sql-loadPack.git
cd sql-loadPack
sudo nano src/packLoad.php # change $PG_PW and other database configs
php sql-loadPack/src/example.php

and check the sandbox at configurated database (psql or pgAdminIII).

Features

  • Make desired tables, defined by your standard datapackage.json, with one resourceLoad_run() instruction.
  • Any additional pre or pos database preparation can be defined by sql_prepare() function.
  • Faster than any other conversion.
  • Optional use of JSON or JSONB datatypes, as "catch-all" fields.
  • Free table names, column names, etc.
  • Options prepared_copy, prepare_auto, prepare_json, and prepare_jsonb.

User guide

Important: at your datapackage.json, in the resources/schema, as the example, add property role in the fields to be preserved as SQL (not encapsulating in JSON field). The default JSON field name is jinfo.

All that you need is exemplified by src/example.lang, see eg. example.php.

About

Load OKFN's tabular-data-package to SQL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages