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.0.tar.gz
(10.1 kB
view hashes)
Built Distribution
tablecrow-1.0.0-py3-none-any.whl
(11.2 kB
view hashes)
Close
Hashes for tablecrow-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 150460e951ac122b7cd035b924b31abaa3ae2d873e230278dc5e04690fc8fcf3 |
|
MD5 | 3700548fb98c983b7a031950e6aa649a |
|
BLAKE2b-256 | cfe9de6ac96416df7db38a31c3958494ffc879efece9fb2d4f10a9be11c6d875 |