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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file etl_db_tools-0.2.1.tar.gz.
File metadata
- Download URL: etl_db_tools-0.2.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98021b280b52c328af36749c58dbc49e8903c0cd92491c9cae73c625a4ce1320
|
|
| MD5 |
348b401e310d996a9ec9f6c66332443d
|
|
| BLAKE2b-256 |
121110cfb904811a6ec4368cffb3a64b3033a53915e9536633289bab1817ee6f
|
File details
Details for the file etl_db_tools-0.2.1-py3-none-any.whl.
File metadata
- Download URL: etl_db_tools-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
677d6bada1a4fad2a142ddb015123730c4511236f1d2b7045dd430f5b314380e
|
|
| MD5 |
6f6a60477486b412c5bfb0ff5e68468d
|
|
| BLAKE2b-256 |
6125fbb8d2be0de9d59b2980f43e782be7772bb373e368f567ed79fe1017816d
|