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
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
poka-0.1-py3-none-any.whl
(2.9 kB
view hashes)