Skip to main content

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>

source

DBConfig

DBConfig (file_path)

Constructor for the DBConfig class. Reads parameters from the specified configuration file and presents them appropriately to the application.


source

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

db_toolkit-0.0.3.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

db_toolkit-0.0.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file db_toolkit-0.0.3.tar.gz.

File metadata

  • Download URL: db_toolkit-0.0.3.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for db_toolkit-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c255330c47b199f2821c32e04afad872bf82363b142f64d73ee8b31257e1b3db
MD5 572b620ce3ac239807f4c351b5c8132c
BLAKE2b-256 f1ae4c203b82d1c4e8c4770802b7e5b546ab1310255db3bd9b7e1b1eb1a08581

See more details on using hashes here.

File details

Details for the file db_toolkit-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: db_toolkit-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for db_toolkit-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0c05ca7ea78846bfaedf1ffca6dd4e75ad5af84c527ba4fe929c501f32a31d19
MD5 c3400e5022aeb63d9edacdf09d59e630
BLAKE2b-256 563766204b5d71528c684ab0b7afc03e84f20195c9bb0262e0faf367c1c96a93

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