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

Developer Guide

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][repo]:

$ pip install db-toolkit

How to use

1. Set up your config file

Create an .ini file with your database connection details:

[CONN_ORC]
user:TEST_USER
pass:<your_password>
dsn:<...>
port:<...>
dbname:<...>

[CONN_MS]
server:<...>
dbname:<...>

2. Create your SQL file

Save your query in data/sql/ with the naming convention <CONNECTION>__<tablename>.sql:

data/sql/ODS__address_ctax.sql

3. Pull the data

from db_toolkit.db_extract import DBExtract

dbe = DBExtract(cfg_fpath='path/to/your/config.ini')
dbe.pull_table('BIODS__address_ctax')

The resulting CSV will be saved to data/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.5.tar.gz (10.3 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.5-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for db_toolkit-0.0.5.tar.gz
Algorithm Hash digest
SHA256 25a36232b0a7cb461599655f1240ed8f6e5d1d1e86d1a861029464f3f08765ad
MD5 ceeabef8096d5694814f8b94b6eb57b8
BLAKE2b-256 8f10821075762d39fa68d905e07f3aa1247d63f6db9b84986038e10af68322a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: db_toolkit-0.0.5-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.13

File hashes

Hashes for db_toolkit-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c853984c4159e786a04b33be80766b8da18e9214fb3472a6fee0ae095440637c
MD5 20d0f7d48e021a7d9058753e52632500
BLAKE2b-256 b63baa05345ebbe66a66bf578198441eb23da05d12a9675d374a94568cdac6f8

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