utility tools for db access and data extraction
Project description
db-toolkit
from db_toolkit.db_extract import *
from db_toolkit.db_connect import *
from pathlib import Path
This file will become your README and also the index of your documentation.
Developer Guide
If you are new to using nbdev here are some useful pointers to get you
started.
Install db_toolkit in Development mode
# make sure db_toolkit package is installed in development mode
$ pip install -e .
# make changes under nbs/ directory
# ...
# compile to have changes apply to db_toolkit
$ nbdev_prepare
Usage
Installation
To use this package in another project, install as below
Install latest from the AzureDevOps repository:
$ pip install git+https://lambeth@dev.azure.com/lambeth/Analytics/_git/db-toolkit
Dependencies
The YAML file for this package dependencies can be found in the envs\
DIR. If using toolkit on another project, it is advisable to define
db-toolkit as the below format YAML.
name: er
channels:
- conda-forge
dependencies:
- jupyterlab
- pandas
- oracledb
- pyodbc
- pip
- pip:
- nbdev
- git+https://lambeth@dev.azure.com/lambeth/Analytics/_git/db-toolkit
- sqlalchemy
Documentation
TODO potentially when github is available.
How to use
Set ini file location path
- TODO init file struct details show example
fpath2 = '../../../data/db_connections/cfg_address.ini'
dbe = DBExtract(cfg_fpath=fpath2)
SQL files
- Saved at ../data/sql
- TODO add details on path <dbname>__<tablename>
DBConfig
DBConfig (file_path)
Constructor for the DBConfig class. Reads parameters from the specified configuration file and presents them appropriately to the application.
DBExtract
DBExtract (cfg_fpath)
Constructor for the DBExtract class. Reads parameters from the specified configuration file Pairs SQL scrit to connection engine Pulls and saves data to landing folder
data_dir = Path("../data")
sql_dir = data_dir / 'sql'
sql_files = list(sql_dir.glob("*.sql"))
sql_files
[Path('../data/sql/BIODS__address_ctax.sql')]
Process files
# files wil be saved at ../data/landing
# dbe.process_save_landing()
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
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 db_toolkit-0.0.2.tar.gz.
File metadata
- Download URL: db_toolkit-0.0.2.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d47c6beb8b4810f78c274978ec65fde58f91c15af8bd9d14378e483780a9932b
|
|
| MD5 |
e8d0dc9dc07a01fa116bd5889c2191bd
|
|
| BLAKE2b-256 |
425dec61d85d8e7564a15aaa76c250f3d278abff0ab1149affc69b206778f791
|
File details
Details for the file db_toolkit-0.0.2-py3-none-any.whl.
File metadata
- Download URL: db_toolkit-0.0.2-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f6710e2c558433c78b8a0613cb07aee9f10e56b4bb9ba361ffb3231282ba382
|
|
| MD5 |
678068abeb7512910116f90ee7020dc6
|
|
| BLAKE2b-256 |
81383d88cf6de83b26ae255ab18a34cf89505faa51370eae5252fee26bc5e8bb
|