Skip to main content

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

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 hashes)

Uploaded source

Built Distribution

py_db_wrapper-1.0.8-py3.6.egg (24.1 kB view hashes)

Uploaded 3 6

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page