=-----------------------------------------=
=-----------------------------------------=
  _______ _______ ___     _______ ___ ___
 |   _   |   _   |   |   |   _   |   Y   )
 |   1___|.  |   |.  |   |.  |   |.  1  /
 |____   |.  |   |.  |___|.  |   |.  _  \
 |:  1   |:  1   |:  1   |:  1   |:  |   \
 |::.. . |::..   |::.. . |::.. . |::.| .  )
 `-------`----|:.`-------`-------`--- ---'
              `--'
=-----------------------------------------=
SQL Orientated Kernels for Jupyter Notebook
=-----------------------------------------=

- | sqlite | mysql | postgres | oracle | -
- | videos | news                      | -

=-----------------------------------------=

-- postgres kernel for jupyter notebook

=-----------------------------------------=

-- howto install
-- howto change postgres connection
-- howto save postgres connection info
-- howto load postgres connection info
-- howto save query result to csv
-- howto change cell result output type

=-----------------------------------------=

-- howto install

pip install --upgrade sqlp-kernel
sqlpk_install

-- optional: 

pip install --upgrade nbtermix
nbtermix --kernel sqlpk

=-----------------------------------------=

-- howto change postgres connection

to open different postgres connection use 

--% dbcon:constr

on the beginning of the cell

where constr consists of string e.g.:

{
  "host": "localhost",
  "port": "5432",
  "database": "postgres",
  "user": "postgres",
  "password": "",
}

the string has to be specified on
one line and has to be preceded by:

--% dbcon:(oneliner constr)

Alternatively You can place the:
sqlpk_conn.json
file in the working directory containg
above information on one line
and then load it using
--% cload
(see below)

=-----------------------------------------=

-- howto save postgres connection info

put following magick on a line:

--% csave

it will save the current connection to the
sqlpk_conn.json
file

=-----------------------------------------=

-- howto load postgres connection info

put following magick on a line:

--% cload

it will load the current connection from
sqlpk_conn.json file

=-----------------------------------------=

-- howto save query result to csv

put following magick on a line:

--% dsave

it will save last query result to csv e.g.

--% dsave dummy

will save last query result to dummy.csv

=-----------------------------------------=

-- howto change output type

put following magick in a cell:

--% otext

to display cells result output in text mode

put following magick in a cell:

--% ohtml

to display cells result output in html mode

=-----------------------------------------=
-- created using vi, gnu screen and debian
=-----------------------------------------=