Skip to main content

playing SQL directly on Python datas

Project description

baresql improves sql agility of python data science beginners by :
  • allowing sql over python objects (list, ranges, …) and SQL Tables,

  • requiring no special module except : pandas.

Inspiration :

  • pypi.python.org/pypi/pandasql : sqldf for pandas

  • pypi.python.org/pypi/ipython-sql : sql magic in Ipython

Features

  • query lists , tuple, dictionnaries, dataframes

  • result as a dataframe, list of records, or list

  • basic Common Table Expression support on old python3.3- versions

Installation

You can install, upgrade, uninstall sqlite_bro.py with these commands:

$ pip install baresql
$ pip install --upgrade baresql
$ pip uninstall baresql

or just launch it from IPython with %load https://raw.githubusercontent.com/stonebig/baresql/master/baresql/baresql.py

Basic Example

from __future__ import print_function, unicode_literals, division  # if Python2.7
from baresql import baresql
bsql = baresql.baresql(keep_log = True )
bsqldf = lambda q: bsql.df(q, dict(globals(),**locals()))

users = ['Alexander', 'Bernard', 'Charly', 'Danielle', 'Esmeralda', 'Franz']
#  We use the python 'users' list like a SQL table
sql = "select 'Welcome ! ' , c0 from users$$"
bsqldf(sql)

Examples

http://nbviewer.ipython.org/github/stonebig/baresql/blob/master/examples/baresql_with_cte.ipynb

Project details


Download files

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

Source Distribution

baresql-1.0.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baresql-1.0.0-py2.py3-none-any.whl (10.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file baresql-1.0.0.tar.gz.

File metadata

  • Download URL: baresql-1.0.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.9

File hashes

Hashes for baresql-1.0.0.tar.gz
Algorithm Hash digest
SHA256 88f9659e767fcf3d59667ed0667407b22e2a76a36e40ba66928bd5a378f555e9
MD5 fac2e4a79bb6d6a6faab16d37cd060df
BLAKE2b-256 e981f437e6527f51d18ce229b92d694b502372aee10eb6261ede0740d48520fb

See more details on using hashes here.

File details

Details for the file baresql-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: baresql-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.9

File hashes

Hashes for baresql-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a24d17f46beb47c221f328f7e06710e3896c6203a8e1909788d7128f27b86f01
MD5 2d3b7bb3bafd455c55b9a1fd2a9a9e4a
BLAKE2b-256 d6d2fe24bcd99d97bddbbccdf191edf4e84c0fdfe894dfff9f54b05f36096ebb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page