Skip to main content

Easy Python database interaction

Project description

easy_db

easy_db is a tool designed to quickly allow Python database interaction capabilities from a consolidated, simple user interface.

Current Features

  • DataBase class can handle both SQLite and Access file-based databases

    • To "connect" to a database, use:
      db = easy_db.DataBase('test_sqlite3_db.db')
      
    • Then, retrieve table names with:
      db.pull_all_table_names()
      
    • Run a "SELECT * ..." query on any table:
      db.pull_full_table('TEST_TABLE')
      
      • returned object is a list of dicts where each dict represents a row and is form {column: value}
      • pull_full_table uses functools.lru_cache to limit repetative database queries
  • For more fine-grained control of database work, theDataBase.provide_db_connection method is a decorator that can provide functions with a database connection (and cursor if specified). ```sh db = easy_db.DataBase('test_sqlite3_db.db')

    @db.provide_db_connection(also_cursor=True)
    def awesome_function(conn, cursor, x):
        data = cursor.execute('...SPECIAL SQL...').fetchall()
        conn.close()
        return data
    ```
    

License

MIT

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

easy_db-0.5.4.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

easy_db-0.5.4-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file easy_db-0.5.4.tar.gz.

File metadata

  • Download URL: easy_db-0.5.4.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for easy_db-0.5.4.tar.gz
Algorithm Hash digest
SHA256 01788ccc31a81399e66fb3f052a0efa0933fad15eece2a09104b21b5b19ece6d
MD5 d0e1c85f118445bef90b3154869aae07
BLAKE2b-256 4a42aae686db413c8adc0b309ef7613cbfbd5ba06aa77753315947d0cda781b8

See more details on using hashes here.

File details

Details for the file easy_db-0.5.4-py3-none-any.whl.

File metadata

  • Download URL: easy_db-0.5.4-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for easy_db-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f761c29357b0edc17853c47b83af14a483416f64e8046fe872a32d757b24703e
MD5 63b801cc2e769ee0bbc456a4cd8f39ea
BLAKE2b-256 8b62828266ad70e8d6cf2170ad1a61cc726079ac25797c1b08fa9326bba7521c

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