Skip to main content

tools for moving data

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.2.tar.gz (5.4 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.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: etl_db_tools-0.2.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for etl_db_tools-0.2.2.tar.gz
Algorithm Hash digest
SHA256 93d2a887470c3e160f7ad278dc287ac9b348212c5e5c8152585b1ce8bfa6ddf6
MD5 6ae50a509993abb22cc42dd40362f42a
BLAKE2b-256 a1efd33ce8f1d8cea6d22b0d358e6d4a24c6bcf21e9e9af43ebc715d1bdd52c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for etl_db_tools-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 df6f4ebbb0b1dd4b1b74ab04188a7d5544c252050f85d1e0edd5013a5d4d60ce
MD5 ab4282a99db1d8948dec94e22dde000a
BLAKE2b-256 68fca63b9b4a11ebde519c2907e441d7f53ad80a4e99f5c62b4392faa0325013

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