Skip to main content

No project description provided

Project description

Etl-db-Tools

This package provides some convenience functions for interacting with databases. For instance executing queries, copying a table etc. It uses pyodbc as a the backend.

install

pip install etl-db-tools

Getting started

Set up a connection with a sql server database

from etl_db_tools.sqlservertools import sqlservertools as sql

cnxn = sql.SQLserverconnection(driver='ODBC Driver 18 for SQL Server', 
                            server='localhost_or_else', 
                            database='TestDB', 
                            uid = 'your_username',
                            pwd = 'your_password', 
                            TrustServerCertificate = 'yes')

Select data from an active connection

You can use the connect method as a context manager.

# create an active connection as context manager
with cnxn.connect() as active_cnxn:
    query = """select id, name from dbo.myTable """
    data = cnxn.select_data(query)

Select_data() yields a generator. This will return list of dictionaries containing the query results.

use the data

for row in data:
    print(f"id = {row['id']}")

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

etl_db_tools-0.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

etl_db_tools-0.2.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file etl_db_tools-0.2.0.tar.gz.

File metadata

  • Download URL: etl_db_tools-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.5.0

File hashes

Hashes for etl_db_tools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9bffba4a0ec1bfd19fadcdb485b208e24a412bdccc0bf0ea5762e14aa69219e5
MD5 16b03e786a887e85513998a98b24fa27
BLAKE2b-256 538ed34b281afa55c7a29ffe5601071bd4244d602b519a4a6be9b28942145d9b

See more details on using hashes here.

File details

Details for the file etl_db_tools-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: etl_db_tools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.5.0

File hashes

Hashes for etl_db_tools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d7397da29e93eae519cc767e3a748df69f0125b48e4d2650575fa4b17ec81e3
MD5 c09f7e2c178700be65a5e3db37a078bb
BLAKE2b-256 f3bb280a30050d975392f78aaaf77ecb6d63317e1d43cce3c53700bd9849f1e3

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