Skip to main content

Psycopg wrapper

Project description

Moliere

psycopg2-binary wrapper for easy application integration (e.g. flask web sites).

Installation

$ pip install moliere

Usage

import moliere

# Creating instance.
db = moliere.Pgdb()

# Connecting to database.
db.connect(host, db_name, user, pwd)

# Query execution. Return list of dicts (psycopg2 RealDictCursor).
result = db.execute(
  'SELECT * FROM table WHERE id>%(id)s;',
  {
    'id': 7
})

# Closing connection.
db.disconnect()

Automatic connection

While create instance Moliere try to find environment variables with endings DB_HOST, DB_NAME, DB_USER and DB_PWD. If it success connection will create automatically.
Also it have builtin instance of Pgbd named DB_OBJ, so if you have necessary environment variables you can use package like this:

from moliere import DB_OBJ

result = DB_OBJ.execute(
  'SELECT * FROM table WHERE id>%(id)s;',
  {
    'id': 7
})

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

Moliere-0.0.8.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

Moliere-0.0.8-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file Moliere-0.0.8.tar.gz.

File metadata

  • Download URL: Moliere-0.0.8.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for Moliere-0.0.8.tar.gz
Algorithm Hash digest
SHA256 1a6338d4712d7bd5c95df81a3d4218c05e2c6660498711ab501f18e9a7fcf63b
MD5 7eac89cd8294b5dd80d4cbe9d9903f99
BLAKE2b-256 0b5ecce62698db3bf4160d95e90fb454b90990d8628a04ecb0fd703ec2d7c519

See more details on using hashes here.

File details

Details for the file Moliere-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: Moliere-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for Moliere-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 80c1ecf37a805e945a40265531e226579ac58cc907ecd22a9597eb1836d06921
MD5 d2ea309683d3b17c92de265ba4d8b838
BLAKE2b-256 153b442975c8e41b0919cf2527f548da402ab7494900903e79db3141b612adc9

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