Metadata-Version: 2.4
Name: db-toolkit
Version: 0.0.1
Summary: utility tools for db access and data extraction
Home-page: https://github.com/Analytics/db-toolkit
Author: frangs
Author-email: giordanofrancisco@duck.com
License: Apache Software License 2.0
Keywords: nbdev jupyter notebook python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastcore
Requires-Dist: pandas
Requires-Dist: sqlalchemy
Provides-Extra: dev
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# db-toolkit


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

``` python
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

``` sh
# 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](https://lambeth@dev.azure.com/lambeth/Analytics/_git/db-toolkit):

``` sh
$ 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.

``` 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

``` python
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\>

------------------------------------------------------------------------

<a
href="https://github.com/Analytics/db-toolkit/blob/main/db_toolkit/db_connect.py#LNone"
target="_blank" style="float:right; font-size:smaller">source</a>

### DBConfig

>  DBConfig (file_path)

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

------------------------------------------------------------------------

<a
href="https://github.com/Analytics/db-toolkit/blob/main/db_toolkit/db_extract.py#LNone"
target="_blank" style="float:right; font-size:smaller">source</a>

### 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*

``` python
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

``` python
# files wil be saved at ../data/landing
# dbe.process_save_landing()
```
