Minimalist python ETL library.
Project description
uETL
Minimalist python ETL library.
Instalation
pip install uetl
Usage
DataWarehouse object
import uetl
import pandas as pd
DWO = uetl.DataWarehouse(name='My DataWarehouse',
dbms='postgres',
host='192.168.1.1',
port='5432',
base='db-name',
user='foo',
pswd='bar')
# Test dw db connection
if DWO.test_conn():
print('Data Warehouse DB connection succeed!')
else:
print('ERROR: Data Warehouse DB failed!')
exit(-1)
# Query the DW
df = DWO.query("SELECT * FROM DIM_DATE")
print(df.head())
DataSrc object
MS SQL Source Object
import uetl
import pandas as pd
host = '192.168.1.1'
port = 49159
base = 'dbname'
user = 'username'
pswd = 'password'
## 1st example - Using 'with' statement
# Create Engine, perform query and dispose engine
with uetl.MssqlSrc('testdb', host, port, base, user, pswd) as SRC:
print(
pd.read_sql('select @@version', SRC.engine)
)
## 2nd example - Create and dispose sqlalchemy engine
db = uetl.MssqlSrc('testdb', host, port, base, user, pswd)
db.create_engine()
print(
pd.read_sql('select @@version', db.engine)
)
db.dispose()
## 3rd example - Use MssqlSrc.query()
db = uetl.MssqlSrc('testdb', host, port, base, user, pswd)
print(
db.query('select @@version')
)
Firebird Source Object
import uetl
import pandas as pd
host = '192.168.1.1'
port = 3050
base = '/path/to/database.fdb'
user = 'sysdba'
pswd = 'masterkey'
chst = 'latin1'
## 1st example - Using 'with' statement
with uetl.FirebirdSrc('testdb', host, port, base, user, pswd) as SRC:
print(
pd.read_sql('SELECT * from rdb$database;', SRC.engine)
)
## 2nd example - Create and dispose sqlalchemy engine
db = uetl.FirebirdSrc('testdb', host, port, base, user, pswd)
db.create_engine()
print(
pd.read_sql('SELECT * from rdb$database;', db.engine)
)
## 3rd example - Use MssqlSrc.query()
db = uetl.FirebirdSrc('testdb', host, port, base, user, pswd)
print(
db.query('SELECT * from rdb$database;')
)
Contributing
To install this package allong with the tools you need to develop and run tests, run the following in your virtualenv:
pip install -e .[dev]
Also, it is necessary to install local libraries:
$ sudo apt-get install libpq-dev
Issues
If you have any problems with or questions about this image, please contact me through a GitHub issue.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file uetl-0.1.5.tar.gz.
File metadata
- Download URL: uetl-0.1.5.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6df518e697d63f899bae0c394c3dadcd32bbfe7fedf22b6772eb86d8d7f003e4
|
|
| MD5 |
8ad2e622e3d27f19c35447b493b32d5a
|
|
| BLAKE2b-256 |
f5494ed12f30204916d9669773a2a8335acc13a3fe7956d04cfbf9c69dd97e59
|
File details
Details for the file uetl-0.1.5-py3-none-any.whl.
File metadata
- Download URL: uetl-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07711c903f77707df37b41a1f5cf78239538baf528db89aaed96fc207f7ef1b7
|
|
| MD5 |
47178292eaf84eed29c5d3bfee9e1e39
|
|
| BLAKE2b-256 |
9d25807b8c9f0fa304e186a4b50f3514ef96d1046cb4f0229f54f598be0e4643
|