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 Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page