Skip to main content
# py-db-wrapper
Shallow wrapper for convenience tools for db management


## TODO:
* Utils - HiveUtils.get_table_columns(). This should probabkly be generic not in Hive utils.
* Statements - standardise the use of database (or schema) and table (or tablename)

## Examples

## Connections
The connection class is a simple wrapper to simplify connecting to know database types.Currently supports MSSQL, MYSQL and HIVE.
### Making a sql alchemy engine

```py
azure_sre_connection = AzureConnection(
host=env('AZURE_HOST'),
port=env('AZURE_PORT'),
database=env('AZURE_DB'),
user=env('AZURE_USER'),
password=env('AZURE_PASSWORD')
)


azure_sre_engine = azure_sre_connection.connect()
```

## Statements
Statement classes are designed to help make various sql statements for different dialect.

```py
columns = HiveUtils.get_table_columns(hive_engine=engine, database='foo', tablename='bar')

stmt = CreateTableStatement(dialect=dialect.Mssql, columns=columns)
sql = stmt.get_sql(schema='doo',table='dar')
print(sql)
```

## Developer notes

Package deployment etc

```sh
python setup.py test
```

```sh
python setup.py sdist bdist_egg
```
```sh
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
twine upload dist/*
```

Release files for py-db-wrapper 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-db-wrapper 1.0.8
File Size Uploaded
py-db-wrapper-1.0.8.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-db-wrapper 1.0.8
File Interpreter ABI Platform
py_db_wrapper-1.0.8-py3.6.egg Legacy Egg format - - Details

Total release size:32.8 kB

Release files / py-db-wrapper-1.0.8.tar.gz

Download URL py-db-wrapper-1.0.8.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7e90751e76aea1ec61e8d7043edce0d1a3e3693b31c2688a2d408c7b398be0cc
BLAKE2b-256 checksum
How to use checksums
799a6b88a3cffd89613a1be8371c5722a6b2b539987378c04151953d3a4c8914
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Release files / py_db_wrapper-1.0.8-py3.6.egg

Download URL py_db_wrapper-1.0.8-py3.6.egg
Size 24.1 kB
Tags Egg
SHA-256 checksum
How to use checksums
1c5d5881b4ac8fed47d846c5a7df014c1eeb0d4b808a8246b8c9f51678922abd
BLAKE2b-256 checksum
How to use checksums
1e81baab506da5b8bc4243d9384a3eb2a561e61f13f45fe6943d0aa6012a1209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page