abstract interface with remote database table
Project description
TableCrow
tablecrow
is an abstraction library over a generalized database table.
Currently, tablecrow
offers an abstraction for PostGreSQL tables with simple PostGIS operations.
pip install tablecrow
Python API:
from datetime import datetime
from tablecrow import PostGresTable
hostname = 'localhost:5432'
database = 'postgres'
table = 'test'
username = 'postgres'
password = '<password>'
# parameters for an SSH tunnel
ssh_hostname = None
ssh_username = None
ssh_password = None
fields = {
'id' : int,
'time' : datetime,
'length': float,
'name' : str
}
table = PostGresTable(hostname, database, table, fields, username=username, password=password,
ssh_hostname=ssh_hostname, ssh_username=ssh_username, ssh_password=ssh_password)
table.insert([
{'id': 1, 'time': datetime(2020, 1, 1), 'length': 4.4, 'name': 'long boi'},
{'id': 3, 'time': datetime(2020, 1, 3), 'length': 2, 'name': 'short boi'},
{'id': 2, 'time': datetime(2020, 1, 2)}
])
table[4] = {'time': datetime(2020, 1, 4), 'length': 5, 'name': 'long'}
record_with_id_3 = table[3]
short_records = table.records_where({'name': 'short boi'})
long_records = table.records_where({'name': '%long%'})
early_records = table.records_where("time <= '20200102'::date")
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
tablecrow-1.0.1.tar.gz
(9.9 kB
view details)
Built Distribution
tablecrow-1.0.1-py3-none-any.whl
(11.0 kB
view details)
File details
Details for the file tablecrow-1.0.1.tar.gz
.
File metadata
- Download URL: tablecrow-1.0.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8070ccfb7ab5aa6ce7cb07d956517c3bd7692a1f571bdf879e7443f5f7f3f3bd |
|
MD5 | 045a130608fcf0e26e20ea9ee12133d6 |
|
BLAKE2b-256 | ab792509937bf838f062e55e997feab470ed2a7944ecb79e376bc38e06397757 |
Provenance
File details
Details for the file tablecrow-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: tablecrow-1.0.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 323eeb2ec8d99885f87f43b5f767b88936b5da3cd4dfd5f16fa74f06da9aa172 |
|
MD5 | 566b530eef8222b9d3de855ed774b9ba |
|
BLAKE2b-256 | aa6e2d06f56555313c789049b8290842038b334ad6a7fda39748fa8ce84b3df0 |