MSSQL Runner
MSSQL Runner provides a way of running MSSQL script with a set of parameters for ETL usage
Installation
MSSQL Runner requires Python 3.6+
python3 -m venv <virtual env name> source <virtual env name>/bin/activate pip install mssql-runner
Quickstart
There are three types of substitution parameters that can be used through mssql runner. The first is a set of standard etl params for ease of use:
-f, from_date, default 1776-07-24
-t,to_date, default 9999-12-31
-b, batch_no, default is -1
The second option is for arbitrary variable expansion. This is passed in the following format because rundeck commands don’t like json quotes:
-p, example: -p “param1-val1, param2-val2”
The final option is to use the batchy integration
-wf, batchy_job, this will substitue parameters from a batchy workflow, this should be a fully qualified batchy job name of the format wf.job, if no job is specified it will assume global
You also have the option to choose which config provider to use.
-conf, config, default core
Datacoco Core - This is default config provider which is looking for a file called etl.cfg in your project root.
etl.cfg folder structure
` [sample] db_name=local user=user server=server password=XXXX port=1433 type=mssql `
Secret Manager - Using this option assumes that you already have secret manager setup in your aws account and as aws key and secret is configured in your environment for you to connect to aws.
Here’s example how to use secret manager config option * -conf secret_manager –secret_project_name <your_project> –secret_team <your_team>
Here is a sample SQL Script. If run in SQL workbench you will be prompted for values for var1 and var2.
drop table if exists zzztemp; create table zzztemp ( dt timestamp, var varchar, from_date timestamp, batch_no integer ); insert into zzztemp values (getdate(), '$[?var1]', '$[?from_date]', '$[?batch_no]'); insert into zzztemp values (getdate(), '$[?var2]', '$[?from_date]', '$[?batch_no]'); select * from zzztemp;
In mssql runner you would use the following params to substitute that value. It is assumed these params would be dynamically substituted by the calling script or informatica process:
python -m mssql_runner.module -s "sample/mssql_runner_test.sql" -p "var1-cat, var2-dog" -b '9999'
Assuming you had workflow config in batchy under wf3, you could also use this script:
python -m mssql_runner.module -s sample/mssql_runner_test.sql -wf wf3
Development
Getting Started
It is recommended to use the steps below to set up a virtual environment for development:
python3 -m venv <virtual env name> source <virtual env name>/bin/activate pip install -r requirements.txt
Testing
pip install -r requirements-dev.txt
To run the testing suite, simply run the command: tox or python -m unittest discover tests
Contributing
Contributions to mssql_runner are welcome!
Please reference guidelines to help with setting up your development environment here.
Metadata
Release files for mssql-runner 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mssql_runner-0.1.6.tar.gz | 5.9 kB | Without provenance | Details |
Release files / mssql_runner-0.1.6.tar.gz
| Download URL | mssql_runner-0.1.6.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1de37984702c3c5834607a13d6b80dbfa9b5371606671eafbf91aac6fa7ca7c
|
|
BLAKE2b-256 checksum How to use checksums |
3a4fc280d7191abe5e43ea5097f39143da792c4e7bb407cf977d46175438a593
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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.7.4
|
Security for mssql-runner 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.