Skip to main content

A simple way to run multiple SQL script pipelines in parallel.

Project description

SQLPipe - Easy way to build SQL pipelines

With SQLPipe it is possible to create a full pipeline and orchestrate dependencies in a simplified way using SQL. The task management uses the asyncio library, so execution is done with the python coroutine system for parallel executions. image Installation:

pip install sqlpipe

Basic Example

Using SqlPipeBuilder. Once the object has been instantiated, use the add_task method to add the scripts to be executed, you must specify a different id for each task, if one task depends on another, use the parent_id parameter to configure the dependency.

from sqlpipe import SqlPipeBuilder

con_str =  'postgres://user:pass@host:port/dbname'
pipe =  SqlPipeBuilder(con_str, connections_limit=5)

# Add custom script
pipe.add_task(id='id_2', script='truncate table t1;', parent_id='id_1')

# Add SQL file script
pipe.add_task(id='id_1', script='queries/tables/t1.sql', file=True)

# Add all .sql in directory
pipe.map_directory('queries')

# Execute all pipeline
pipe.execute()
# Start from specifc task
pipe.execute('id_2')

Using CLI Call the CLI and pass the directory (-d or --directory) parameter, after that all .sql files in the directory and subdirectories will be started. To configure a dependency just put the dependency in a comment on script file, example /* @parent=my-parent-task */.

python -m sqlpipe -d queries

It's possible to call specific task passing the task parameter (-t or --task).

python -m sqlpipe -d queries -t task-id

Supported Databases

  • MySQL
  • PostgreSQL
  • Redshift

Licence 📜 Code released under the MIT license.

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

sqlpipe-0.2.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

sqlpipe-0.2.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file sqlpipe-0.2.1.tar.gz.

File metadata

  • Download URL: sqlpipe-0.2.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for sqlpipe-0.2.1.tar.gz
Algorithm Hash digest
SHA256 11401bfbd141d36f2085e5d65883ffdde3ac91726098b5e78604988ce4cabb88
MD5 b0b25d7603e9199833e79102855e87ec
BLAKE2b-256 4abe35c14e32199105fed22e22e2a7e8d1010d100f632128f46495c3c4d2f53c

See more details on using hashes here.

File details

Details for the file sqlpipe-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sqlpipe-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for sqlpipe-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5df9b9819e6f53a03d6cce359101e7a6fb77b3c43a265734e54703be5e79d4a0
MD5 a74a2a2152bc478aeccf107689bdbe9f
BLAKE2b-256 f9e3bdda0bc95ee79fd742ba7afc4f6549868d25521a98c4d5b697bb1d7567db

See more details on using hashes here.

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