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.1.6.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file psyshort-0.1.6.tar.gz.
File metadata
- Download URL: psyshort-0.1.6.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1afbd3f93f476baafdbb2f6974688bae74eeae3add336d6be63014c9af53cb90
|
|
| MD5 |
fcb61542b7a4d710ab1fc06418b81a87
|
|
| BLAKE2b-256 |
5a4c532400a9c8f8a217b6a9121bd02be01e7f47a67a41d7ff03cc088f5cff9b
|
File details
Details for the file psyshort-0.1.6-py3-none-any.whl.
File metadata
- Download URL: psyshort-0.1.6-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b9758b602ee9186b581913fb4187890350f3630c03a55f75f9cad50bc0ccde
|
|
| MD5 |
a9a93e4b5d70089db34909650c21aa97
|
|
| BLAKE2b-256 |
1691c1199b1e8bcae35f0e31744277b0afeb023b34a95f0c26902223856f924a
|