Skip to main content

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

MSSql ODBC Driver

Issues

If you have any problems with or questions about this image, please contact me through a GitHub issue.

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

uetl-0.1.5.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uetl-0.1.5-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

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

Hashes for uetl-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6df518e697d63f899bae0c394c3dadcd32bbfe7fedf22b6772eb86d8d7f003e4
MD5 8ad2e622e3d27f19c35447b493b32d5a
BLAKE2b-256 f5494ed12f30204916d9669773a2a8335acc13a3fe7956d04cfbf9c69dd97e59

See more details on using hashes here.

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

Hashes for uetl-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 07711c903f77707df37b41a1f5cf78239538baf528db89aaed96fc207f7ef1b7
MD5 47178292eaf84eed29c5d3bfee9e1e39
BLAKE2b-256 9d25807b8c9f0fa304e186a4b50f3514ef96d1046cb4f0229f54f598be0e4643

See more details on using hashes here.

Supported by

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