Skip to main content

Create your ETL integrations easy and quick!

Project description

ETL Lib

Upload Python Package PyPI version

This is a simple package built for Portobello Shop integrations, and now is available as ETL lib.

Can be used with several services, like:

  • Oracle
  • Salesforce
  • MSSQL Server
  • GSuite
  • Microvix
  • ODBC Drivers: PYODBC and SQLALCHEMY
  • And any REST services ...

Comming soon:

  • RabbitMQ
  • Kafka
  • OpenVault (Credentials)
  • ...

Basic Usage

Rewrite ETL ABC class

Use inheritance and rewrite the three abstract methods (even if you don't use it):

from etl_pbshop import ETL, Connectors

class MyETL(ETL):
   def __init__(self):
       self.config = MyConfiguration()
       self.log = self.config.log
       self.connector = Connectors(
           config=self.config, 
           log=self.log, 
           services={'google': 'PROD', "salesforce": "PROD"}
       )

   def extract(self):
       pass  # extract the needed data using Connectors

   def transform(self): 
       pass  # do some transformations

   def load(self):
       pass  # upload your transformations

Main caller:

On the main caller, you can simply:

if __name__ == '__main__':
   etl = MyETL()
   etl.config.start()
   try:
       etl.run()
       exit(0)
   except Exception as e:
       etl.get_error(f"ERROR on main: {str(e)}")
       raise e
   finally:
       etl.config.finish()

Rewriting default ConfigModel:

In another class, you can rewrite the ConfigModel class and input your values:

from etl_pbshop.config_model import ConfigModel

class MyConfiguration(ConfigModel):
   def __init__(self):
       super().__init__(__file__)
       self.SQL_QUERIES = {
           "produtos": "SELECT * FROM Products2"
       }
       self.INTEGRATION_SPREADSHEET_ID = '654asd5as1das5d165a4d68'     

Environment variables:

You can put your environment variables to use the Connectors class. In a .env file, set it in groups, like:

INTEGRACAO_ORACLE_ID_1=1
INTEGRACAO_ORACLE_TOKEN_VALUE_1=asd1234asd==
INTEGRACAO_ORACLE_TOKEN_URL_1=http://example.com/token
INTEGRACAO_ORACLE_METHOD_URL_1=http://example.com/method_to_post
INTEGRACAO_ORACLE_USER_1=asd..
INTEGRACAO_ORACLE_PASS_1=qwerty..
INTEGRACAO_ORACLE_ENVIRONMENT_1=DEV

INTEGRACAO_MICROVIX_ID_1=1
INTEGRACAO_MICROVIX_TOKEN_VALUE_1=1234-123-123-1234
INTEGRACAO_MICROVIX_METHOD_URL_1=https://webapi.microvix.com.br/1.0/api/method
INTEGRACAO_MICROVIX_USER_1=user
INTEGRACAO_MICROVIX_PASS_1=pass
INTEGRACAO_MICROVIX_ENVIRONMENT_1=PROD

INTEGRACAO_SALESFORCE_ID_1=1
INTEGRACAO_SALESFORCE_TOKEN_VALUE_1=qwerty
INTEGRACAO_SALESFORCE_METHOD_URL_1=https://login.salesforce.com/services/Soap/u/47.0
INTEGRACAO_SALESFORCE_USER_1=username@example.com
INTEGRACAO_SALESFORCE_PASS_1=myPass
INTEGRACAO_SALESFORCE_ENVIRONMENT_1=PROD

You only need to keep the pattern: INTEGRACAO_<service_name>_<key_name>_<group_id>

More info, please contact: daniel.camargo@portobelloshop.com.br

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

etl-pbshop-0.1.7.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

etl_pbshop-0.1.7-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file etl-pbshop-0.1.7.tar.gz.

File metadata

  • Download URL: etl-pbshop-0.1.7.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for etl-pbshop-0.1.7.tar.gz
Algorithm Hash digest
SHA256 ac7b4efa7b54373929a17ec8af283560b0b86077cc2501703f0850d244d54621
MD5 3e46d0820e41ca8bdb9f51d73327a41a
BLAKE2b-256 b43eff36d4e0c1eb9e62fe19d22474ddc426113a50804ed8542a59fc4d641234

See more details on using hashes here.

File details

Details for the file etl_pbshop-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: etl_pbshop-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for etl_pbshop-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5e4675f14e30f90b39eab963a1c3661f9fb90870a7c1adbaf4783705ca7f579e
MD5 4db2ef7a58d3edb736554db47c41aa02
BLAKE2b-256 4f7d849fcc929540361081c3d2b371f1ec3ec249a5a150b76103182267ee87fe

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