Skip to main content

Poka database interface

Project description

Poka database interface

Interface buildet on mysql-connector

Set up

pip install -r req.txt

Usage

Create Poka instance

from poka_constructor import Poka

cfg = database config
poka_instance_1 = Poka(cfg)  # Set database config

Select table

from poka_constructor import Poka

cfg = database config
poka_instance_1 = Poka(cfg)  # Set database config
poka_instance_1.table("users")  # Set table

Select from table

from poka_constructor import Poka

cfg = database config
poka_instance_1 = Poka(cfg)  # Set database config
poka_instance_1.table("users")  # Set table
poka_instance_1.where("column", "=", value)  # Set where instruction
poka_instance_1.whereNotNull("column", "=", value)  # Set is not null check
poka_instance_1.whereIn("column", "args")  # Set where in instruction
poka_instance_1.get()  # Fetch records from table 

Insert to db

from poka_constructor import Poka

cfg = database config
poka_instance_1 = Poka(cfg)  # Set database config
poka_instance_1.table("users")  # Set table
poka_instance_1.insert({"colum_name": "value", "column_name2": "value"})  # Set insert data

Update records

from poka_constructor import Poka

cfg = database config
poka_instance_1 = Poka(cfg)  # Set database config
poka_instance_1.table("users")  # Set table
poka_instance_1.update({"colum_name": "value", "column_name2": "value"})  # Set update data

Limit

from poka_constructor import Poka

cfg = database config
poka_instance_1 = Poka(cfg)  # Set database config
poka_instance_1.table("users")  # Set table
poka_instance_1.where("column", "=", value)  # Set where instruction
poka_instance_1.take(5)  # Set count of fetching records
poka_instance_1.get()  # Fetch records from table

Order by ASC | DESC

from poka_constructor import Poka

cfg = database config
poka_instance_1 = Poka(cfg)  # Set database config
poka_instance_1.table("users")  # Set table
poka_instance_1.where("column", "=", value)  # Set where instruction
poka_instance_1.take(5)  # Set count of fetching records
poka_instance_1.orderBy("column", "ASC")  # Set order by instruction
poka_instance_1.get()  # Fetch records from table

One line requests

For example: Select from table

from poka_constructor import Poka

cfg = database config
poka_instance_1 = Poka(cfg)
                .table("users")
                .where("column", "=", value)
                .whereNotNull("column", "=", value)
                .whereIn("column", "args")
                .get() 

Other functions work the same.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poka-0.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file poka-0.1-py3-none-any.whl.

File metadata

  • Download URL: poka-0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for poka-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34b229fdc2aa0f1cc54b449c290faa8c8524082e74a4035b8da53fcfc2b9096a
MD5 74aea580d3d849c4c3294723e8250ec9
BLAKE2b-256 744a3e906f515b34a438517a65e7f71c67f85dbb256bdf0849060625095975a4

See more details on using hashes here.

Supported by

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