Skip to main content

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


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)

Uploaded Source

Built Distribution

psyshort-0.1.6-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

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

Hashes for psyshort-0.1.6.tar.gz
Algorithm Hash digest
SHA256 1afbd3f93f476baafdbb2f6974688bae74eeae3add336d6be63014c9af53cb90
MD5 fcb61542b7a4d710ab1fc06418b81a87
BLAKE2b-256 5a4c532400a9c8f8a217b6a9121bd02be01e7f47a67a41d7ff03cc088f5cff9b

See more details on using hashes here.

File details

Details for the file psyshort-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for psyshort-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c6b9758b602ee9186b581913fb4187890350f3630c03a55f75f9cad50bc0ccde
MD5 a9a93e4b5d70089db34909650c21aa97
BLAKE2b-256 1691c1199b1e8bcae35f0e31744277b0afeb023b34a95f0c26902223856f924a

See more details on using hashes here.

Supported by

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