Making psycopg2 a little simpler to use.
Project description
Making psycopg2 a little simpler to use.
Usage:
from psyshort import Psyshort
psy = Psyshort(
hostname="db.example.com",
dbname="example_database",
username="postgres_user",
password="pa$$w0rd"
)
select = psy.select(
table="my_table", # Table's name (mandatory).
fields=[
"id",
"first_name",
"last_name",
"phone",
], # Fields to include in the result (optional).
where="last_name = 'Smith'", # Select only rows where last_name = 'Smith' applies (optional).
limit=1000, # Limit result to 1000 records (optional).
order_by="first_name" # Order the result by 'first_name' column (optional).
)
result = select["result"] # The selected records.
duration = select["duration"] # The duration of the operation.
psy.insert(
table="my_table", # Table's name (mandatory).
columns=[
"first_name",
"last_name",
"phone",
], # Columns by which to insert values (mandatory).
row={
"first_name": "John",
"last_name": "Smith",
"phone": "KL5-2390"
} # Row to insert to the table (mandatory).
)
psy.disconnect() # Occurs on psy.__del__
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
psyshort-0.0.10.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for psyshort-0.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8632a385b60221b305f29f0a801ba5a7215f9d35b01e0312a09d98ad6f1693b |
|
MD5 | 07f21193b1af6181f3d74cb4c41393c6 |
|
BLAKE2b-256 | 402fea9959891c7e165ef05276911a0988970f7883a35b4747106e5bca23d34a |