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.4.tar.gz (11.7 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.4-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: db_toolkit-0.0.4.tar.gz
  • Upload date:
  • Size: 11.7 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.4.tar.gz
Algorithm Hash digest
SHA256 925f095bee521ab32b9ce05d54bbc2ffe6d2e01d07491f2f21e73e538b838597
MD5 1dd17e26b1ae53ae6bb42860f7ac1b7b
BLAKE2b-256 ba3e720a54092dc797cb69efe7d72f8c9dd6e1aa881e8bf065fa1d9961151294

See more details on using hashes here.

File details

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

File metadata

  • Download URL: db_toolkit-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 11.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7cd3367341af122fe9c74616e0f0aa3c94f5adb53edf890cd80acf3b781b2a47
MD5 141d5389d984ffec9dde30ccc25e26f9
BLAKE2b-256 97c3d3cbe88c9751bd8872e7c9e406b3ffdca9d71bcd5a06382d3d3440bff935

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