Skip to main content

abstract interface with remote database table

Project description

TableCrow

tests build version license

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


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.3.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

tablecrow-1.0.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file tablecrow-1.0.3.tar.gz.

File metadata

  • Download URL: tablecrow-1.0.3.tar.gz
  • Upload date:
  • Size: 10.0 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

Hashes for tablecrow-1.0.3.tar.gz
Algorithm Hash digest
SHA256 87f86d495783934ac5f34df51a007f807d275fa796de30c52a58c539d8259827
MD5 17a8755173a36db434a52b628bc9cfde
BLAKE2b-256 dd1e5101f162974626eb6801a3c46d8b9e376e36f017d439477e6f7d01667cc9

See more details on using hashes here.

Provenance

File details

Details for the file tablecrow-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: tablecrow-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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

Hashes for tablecrow-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 af6da0ca6c8ca0fa7e2b3df970b9adfa05d4f76b5447f318524c3c78153a1a55
MD5 eb72ac04b9c4a1171d8bde6f25ff82e1
BLAKE2b-256 cf84a1f89fa0cd961179da1ca0fae613a29b51190f6f6ee2af529d62288e4f20

See more details on using hashes here.

Provenance

Supported by

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