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.1.1a1.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.1.1a1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file etl_db_tools-0.1.1a1.tar.gz.

File metadata

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

File hashes

Hashes for etl_db_tools-0.1.1a1.tar.gz
Algorithm Hash digest
SHA256 b0fed16d3c3b6fc2ebb75e3b80c3021c2f17cb39ff3b4ee7241e50e187ca1207
MD5 a1a5238292055413910f42fd53875ab0
BLAKE2b-256 cbd79f8188bf6241c52d6d93d6acdea4f021108f16ebace670febc14c9cd7c67

See more details on using hashes here.

File details

Details for the file etl_db_tools-0.1.1a1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for etl_db_tools-0.1.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 28755efddc526db2d6cfce4f8a86555fa9f86584328a70b426d18be4323e7bfd
MD5 ae626314e99d120cc31603d693fa4483
BLAKE2b-256 7fc9fa00e2c443be268cc2021413387e41f49b971366b6e507776cf414a6cc70

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