Automatic Contract Creation
Automatic Contract Creation is a Python library that is designed to auto-generate various types of contracts based on the soda syntax using LLM.
Features
In the current version, connection to DB such as Clickhouse and Trino is configured. By connecting to the database, you can generate and/or upload a statistical report, as well as generate a soda contract.
Get Started
Requirements
trino==0.327.0
clickhouse-connect==0.6.22
pandas==2.2.3
polars==0.20.21
openai==1.37.0
regex==2024.9.11
load-dotenv==0.1.0
python=3.11.5
pyarrow==17.0.0
The rule based approach uses soda version 3.3.5 (SODAGenerateContract).
The LLM approach uses soda versions 3.1.5(LlamaGeneratorSODAContract).
Install and run
You can install the library using pip:
pip install automatic-contract-creation
Import the necessary objects. To use all the functionality, you can contact SODAGenerator
from automatic_contract_creation import SODAGenerator
from automatic_contract_creation import LlamaGenerateSuite
from automatic_contract_creation import LlamaGeneratorSODAContract
To rule based approach:
Create a connection object by passing the connector type and credits in dictionary format. Use the methods to auto-generate a contract or generate a statistical report.
To LLM approach:
Create a file in the virtual environment ".env" with its credits example
connection_name='clickhouse or trino'
host='hostname'
port=port
user='username'
password='password'
llama_api_url='your api url for llm'
token='token_omd'
use your method
print(LlamaGenerateSuite('db_name.table_name').get_suite())# prints the tests (the path is specified by the click example)
LlamaGenerateSuite('catalog.schema.table').generate_suite()# upload a yaml file with tests (the path is specified following the example of trino)
LlamaGenerateSuite('catalog.schema.table').save_profiling()# will save the profiling
print(LlamaGeneratorSODAContract('catalog.schema.table').generate_schema_contract())# will print the contract
LlamaGeneratorSODAContract('catalog.schema.table').get_soda_contracts()# will download the yaml file with the contract
Metadata
Release files for automatic-contract-creation 2.0
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 | |
|---|---|---|---|---|
| automatic_contract_creation-2.0.tar.gz | 29.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| automatic_contract_creation-2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.4 kB
Release files / automatic_contract_creation-2.0.tar.gz
| Download URL | automatic_contract_creation-2.0.tar.gz |
|---|---|
| Size | 29.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e88fa66b1b06fb38dbebb0cd9fff3f2b0b03b127a2ff74d58502ec0ef621526
|
|
BLAKE2b-256 checksum How to use checksums |
68eca7e1f98907344d48a58fac982f1a50c62e67e43a9cff2f1207aa079e7814
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.5
|
Release files / automatic_contract_creation-2.0-py3-none-any.whl
| Download URL | automatic_contract_creation-2.0-py3-none-any.whl |
|---|---|
| Size | 43.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb242e37723b05706d7eeaee9f463abccbe0245213320dd972d1f89c2004c566
|
|
BLAKE2b-256 checksum How to use checksums |
8b97045aae458c324d155f48354668a33cade0ab4f56ee3375f23aecafa0b219
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.5
|
Security for automatic-contract-creation 2.0
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.