Pandas-like interface for manipulating SQL databases.
Project description
dfdb
Pandas-like interface for manipulating SQL databases
Install
pip install dfdb
Overview
This package is a lightweight wrapper around SQLalchemy. As such, it can be used with a variety of database backends, although as of now the package has only been tested with SQLite.
The dfdb.Database
class provides a dict-like interface of manipulating tables in a SQL database. For example, if we create a Database
object like
db = dfdb.Database(filename='data.db', drivername='sqlite')
Then we can perform operations on a table called df
in data.db
by calling, for example
db['df'].groupby('col1').agg(mean=('col2', 'mean')).fetch()
db['df']
is a dfdb.DataFrame
object that behaves almost identically as a pandas.DataFrame
. The only difference is that you need to call .fetch()
, which establishes a connection to the database and performs the corresponding SQL query.
Adding rows to the table is as simple as
db['df'].append({'col1': 1, 'col2': 2})
More detailed documentation to follow in the future.
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 dfdb-0.1.9.tar.gz
.
File metadata
- Download URL: dfdb-0.1.9.tar.gz
- Upload date:
- Size: 29.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9bc71b894b0b75e8461d17e14cbca217c916b12e6ff152c6b8d30e5f5b199d8 |
|
MD5 | 583aedc08abc5e28f3dae5486e69da02 |
|
BLAKE2b-256 | 1f89df271baa6c32eeb6736c0b43dff864f68fb20791e545aab0262e1b1f7ce6 |
File details
Details for the file dfdb-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: dfdb-0.1.9-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9dcae7b441072987bfd5b799627bc113126406939abd34eb72b9d666e888890 |
|
MD5 | 4e13c239e1ab16bea8e326b33e6f38ea |
|
BLAKE2b-256 | db675b97d0b6e42b7811593d438f1e2cff247f979760c0334c799dc8ba4d092d |