Jupancon, connector to several DBs that returns pandas. Magic included.
Project description
jupancon
Database Connectors and SQL magics for Jupyter lab. jupancon
= Jupyter + Pandas + Connectors.
Features
- Connector to Redshift
- Connector to Bigquery
- Optional automatic tunnel setting through an SSH Bastion
- Querying capabilities
- Jupyter Magics for querying
Install
pip install jupancon
Configure
Write a ~/.jupancon/config.yml
YAML file that looks similar to the following C&P from my actual config file (heavily censored for obvious reasons):
default: my-redshift-cluster
my-redshift-cluster:
type: redshift
host: XXXXXX.XXXXXX.XXXXXXX.redshift.amazonaws.com
# explicitly setting redshift port (optional)
port: 5439
user: XXXXXXXX
pass: XXXXXXXX
dbname: XXXXXX
my-gcp:
type: bigquery
project: XXXXX-XXXXX-123456
my-redshift-behind-sshbastion:
type: redshift
use_bastion: true
bastion_server: censored.bastion.server.com
bastion_user: XXXXXX
bastion_host: XXXXXX.XXXXXX.XXXXXX.redshift.amazonaws.com
host: censored.main.server.com
user: XXXXXXXX
pass: XXXXXXXX
dbname: XXXXXX
How to use
Regular usage
from jupancon import query, list_schemas, list_tables
list_schemas()
list_tables()
query("select * from foo")
Magical usage
from jupancon import load_magics
load_magics()
select * from foo
df = %select * from foo
%%sql
select *
from foo
where cond = 1
and whatever
Development
Current status: Jupancon has enough basic features that it's worth open sourcing, but the documentation is still lacking.
TODO list
- Complete docs (low level stuff, exhaustive features, maybe sphinx/rdd?)
- Add animated gifs to docs
- Add query monitoring and cancelling functionality
Features that aren't worth adding right now
- Autocomplete and autodiscover of databases is possible, but not trivial at all. In addition, I'll like to find a way of not adding any extra configuration. Regardless, not worth it until the TODO list above is tackled. See this project for a successful example.
- Because of the current architecture of Jupyter Lab, syntax highlighting is not feasible to add (as it was in Jupyter Notebook). This might change in the future. See this git issue for more details.
A note about Unit Testing
I would like to publish decent unit testing, but this library is hard to test because all the databases currently queried for it's development are either tests that cost me money or private (my clients') databases. Any ideas on how to write an open source, non exploitable set of unit tests for Redshift or BigQuery are very welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jupancon-0.1.4.tar.gz
.
File metadata
- Download URL: jupancon-0.1.4.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66d8150db114f90e29ca785fd0e5458255fc878094b07cf6a77578794415866e |
|
MD5 | 522a1f709b37274128e0b4246cfb74ec |
|
BLAKE2b-256 | 3079cca1ad9520935db7adfcc7a1a4a25d6822f037981cee8d795e0278502c10 |
File details
Details for the file jupancon-0.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: jupancon-0.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08213bc81e69f43ffdb8b304f8f0da6e58ca99a48ca4c508230c38d0998b64c6 |
|
MD5 | e4c6f4df5da1e1cbd9ba5c311f796cac |
|
BLAKE2b-256 | 7fdf0948314a69a38fa94041c6a0922ac9bcd627fc51738ce219659094ae2617 |