Skip to main content

Patabase

Database API as it described in PEP 249 is a comprehensive API. It's amazing and we can implement any advanced scenario with it. But for a simple task we don't need an advanced or comprehensive tool. We just need a simple tool to do the job for us. After all we all agree that "Simple is better than complex."

Installation

We'd like to support all the databases, but we don't like to install all the drivers of all the databases. So first of all install and config your database driver then install corresponding python package:

pip install -U psycopg2  # for Postgres

pip install -U pyodbc  # for Microsoft SQL Server 

now you can install it from PyPi by following command:

pip install -U patabase

or if you prefer the latest development version, you can install it from the source:

git clone https://github.com/xurvan/patabase.git
cd patabase
python setup.py install

Quickstart

SQL commands are usually categorized into DDL, DQL, DML, DCL and TCL but we are going to categorized them into different categories:

  • Select: a command with output that is not going to change anything
  • Perform: a command without output that is going to change something
  • Function: a stored procedure with output
  • Procedure: a stored procedure without output

so let us see some code:

from patabase import Postgres

db = Postgres(host='localhost', user='USERNAME', password='PASSWORD', database='DATABASE_NAME')

db.perform('''
create table users
(
    id          serial primary key not null,
    name        varchar            not null,
    username    varchar unique     not null
)
''')

rows = db.select('select * from users')

for row in rows:
    print(row)

TODO

  • Support PostgreSQL
  • Support Microsoft SQL Server
  • Support SQLite
  • Support MySQL
  • Support Oracle Database

Metadata

Release files for patabase 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patabase 0.2.2
File Size Uploaded Provenance
patabase-0.2.2.tar.gz 3.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for patabase 0.2.2
File Interpreter ABI Platform
patabase-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / patabase-0.2.2.tar.gz

Download URL patabase-0.2.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
aa17db4d045d9db65fa6a737f654787784444a387be256541412c67ac86d1bf7
BLAKE2b-256 checksum
How to use checksums
03d46fbd00b7164dab57d69be1fb7aa58dea06497d9b8435a6a053a9ae376ee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

Release files / patabase-0.2.2-py3-none-any.whl

Download URL patabase-0.2.2-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c19c5c9e1f30014a346697af4271110c8e13c96f359692440bcd7fc63d40f769
BLAKE2b-256 checksum
How to use checksums
a781ecf941609a73b5730902293f0aa0c5121165a2c71ceee9b5392cfee34491
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

Security for patabase 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page