Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Utility for unified querying across data sources

Project description

Spackl

Abstracting data source idiosyncrasies so you can stop reading Q&A forums and start reading your data.

Installation

pip install spackl

Usage Overview

Query Data

from spackl import db, file

conf = db.Config()

pg = db.Postgres(**conf.default)
bq = db.BigQuery(**conf.bq_datalake)
csv = file.CSV('/path/to/file.csv')

# Same method for all sources
pg_results = pg.query('SELECT id FROM schema.some_table')
bq_results = bq.query('SELECT id FROM dataset.some_table')
csv_results = csv.query()

Access Query Results

by index

results[0]
# (1234,)

by attribute

results.id
# (1234, 1235, 1236)

by key

results['id']
# (1234, 1235, 1236)

index by index

results[0][0]
# 1234

attribute by index

results.id[0]
# 1234

key by index

results['id'][0]
# 1234

index by attribute

results[0].id
# 1234

index by key

results[0]['id']
# 1234

Other Data Formats

# Pandas Dataframe
results.df()

# JSON String
results.json()

# List of tuples
results.list()

# Vertical dictionary
results.dict()

CHANGELOG

0.1.0 (2019-03-09)

  • initial release

Project details


Release history Release notifications

This version
History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
spackl-0.1.0-py2.7.egg (34.5 kB) Copy SHA256 hash SHA256 Egg 2.7
spackl-0.1.0-py3.6.egg (35.5 kB) Copy SHA256 hash SHA256 Egg 3.6
spackl-0.1.0-py3.7.egg (35.6 kB) Copy SHA256 hash SHA256 Egg 3.7
spackl-0.1.0.tar.gz (11.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page