No project description provided
Project description
# 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/*
```
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/*
```
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
py-db-wrapper-1.0.8.tar.gz
(8.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
py_db_wrapper-1.0.8-py3.6.egg
(24.1 kB
view details)
File details
Details for the file py-db-wrapper-1.0.8.tar.gz.
File metadata
- Download URL: py-db-wrapper-1.0.8.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e90751e76aea1ec61e8d7043edce0d1a3e3693b31c2688a2d408c7b398be0cc
|
|
| MD5 |
d3565099906061d9739b4ad480231b0e
|
|
| BLAKE2b-256 |
799a6b88a3cffd89613a1be8371c5722a6b2b539987378c04151953d3a4c8914
|
File details
Details for the file py_db_wrapper-1.0.8-py3.6.egg.
File metadata
- Download URL: py_db_wrapper-1.0.8-py3.6.egg
- Upload date:
- Size: 24.1 kB
- Tags: Egg
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c5d5881b4ac8fed47d846c5a7df014c1eeb0d4b808a8246b8c9f51678922abd
|
|
| MD5 |
0c22c83f71cbffcda059f0634658116b
|
|
| BLAKE2b-256 |
1e81baab506da5b8bc4243d9384a3eb2a561e61f13f45fe6943d0aa6012a1209
|