prefect-soda-core


Nameprefect-soda-core JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/sodadata/prefect-soda-core
SummaryPrefect 2.0 collection for Soda Core
upload_time2023-12-12 08:27:30
maintainer
docs_urlNone
authorSoda Data NV.
requires_python>=3.7
licenseApache License 2.0
keywords prefect
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # prefect-soda-core

## Welcome!

Prefect 2.0 collection for Soda Core

## Getting Started

### Python setup

Requires an installation of Python 3.7+.

We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.

These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the [Prefect documentation](https://orion-docs.prefect.io/).

### Installation


`prefect-soda-core` is based on `soda-core`.  
As `soda-core` requires you to specify the right option for your database, so does `prefect-soda-core`.  
I.e. to use `prefect-soda-core` with Snowflake, run the following:

```bash
pip install prefect-soda-core[snowflake]
```

You can find the list of supported options in `setup.py`.

**Please note that since this integration is built on top of Soda CLI, it is not possible to run data quality checks using Spark.**

### Write and run a flow

```python
from prefect import flow
from prefect.context import get_run_context
from prefect_soda_core.soda_configuration import SodaConfiguration
from prefect_soda_core.sodacl_check import SodaCLCheck
from prefect_soda_core.tasks import soda_scan_execute


@flow
def run_soda_scan():
    soda_configuration_block = SodaConfiguration(
        configuration_yaml_path="/path/to/config.yaml"
    )
    soda_check_block = SodaCLCheck(
        sodacl_yaml_path="/path/to/checks.yaml"
    )
    
    # Using the flow_run_name as the name of the file to store the scan results
    flow_run_name = get_run_context().flow_run.name
    scan_results_file_path = f"{flow_run_name}.json"
    
    return soda_scan_execute(
        data_source_name="my_datasource",
        configuration=soda_configuration_block,
        checks=soda_check_block,
        variables={"var": "value"},
        scan_results_file=scan_results_file_path,
        verbose=True,
        return_scan_result_file_content=False,
        shell_env={"SNOWFLAKE_PASSWORD": "********"}
    )

run_soda_scan()
```

## Resources

If you encounter any bugs while using `prefect-soda-core`, feel free to open an issue in the [prefect-soda-core](https://github.com/sodadata/prefect-soda-core) repository.

If you have any questions or issues while using `prefect-soda-core`, you can find help in either the [Prefect Discourse forum](https://discourse.prefect.io/) or the [Prefect Slack community](https://prefect.io/slack).

## Development

If you'd like to install a version of `prefect-soda-core` for development, clone the repository and perform an editable install with `pip`:

```bash
git clone https://github.com/sodadata/prefect-soda-core.git

cd prefect-soda-core/

pip install -e ".[dev]"

# Install linting pre-commit hooks
pre-commit install
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sodadata/prefect-soda-core",
    "name": "prefect-soda-core",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "prefect",
    "author": "Soda Data NV.",
    "author_email": "vijay@soda.io",
    "download_url": "https://files.pythonhosted.org/packages/88/72/75a4fb5e037f40b96d9b0f2d1e5b0f86de45f4e385ea2e816f45459c05db/prefect-soda-core-0.1.8.tar.gz",
    "platform": null,
    "description": "# prefect-soda-core\n\n## Welcome!\n\nPrefect 2.0 collection for Soda Core\n\n## Getting Started\n\n### Python setup\n\nRequires an installation of Python 3.7+.\n\nWe recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.\n\nThese tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the [Prefect documentation](https://orion-docs.prefect.io/).\n\n### Installation\n\n\n`prefect-soda-core` is based on `soda-core`.  \nAs `soda-core` requires you to specify the right option for your database, so does `prefect-soda-core`.  \nI.e. to use `prefect-soda-core` with Snowflake, run the following:\n\n```bash\npip install prefect-soda-core[snowflake]\n```\n\nYou can find the list of supported options in `setup.py`.\n\n**Please note that since this integration is built on top of Soda CLI, it is not possible to run data quality checks using Spark.**\n\n### Write and run a flow\n\n```python\nfrom prefect import flow\nfrom prefect.context import get_run_context\nfrom prefect_soda_core.soda_configuration import SodaConfiguration\nfrom prefect_soda_core.sodacl_check import SodaCLCheck\nfrom prefect_soda_core.tasks import soda_scan_execute\n\n\n@flow\ndef run_soda_scan():\n    soda_configuration_block = SodaConfiguration(\n        configuration_yaml_path=\"/path/to/config.yaml\"\n    )\n    soda_check_block = SodaCLCheck(\n        sodacl_yaml_path=\"/path/to/checks.yaml\"\n    )\n    \n    # Using the flow_run_name as the name of the file to store the scan results\n    flow_run_name = get_run_context().flow_run.name\n    scan_results_file_path = f\"{flow_run_name}.json\"\n    \n    return soda_scan_execute(\n        data_source_name=\"my_datasource\",\n        configuration=soda_configuration_block,\n        checks=soda_check_block,\n        variables={\"var\": \"value\"},\n        scan_results_file=scan_results_file_path,\n        verbose=True,\n        return_scan_result_file_content=False,\n        shell_env={\"SNOWFLAKE_PASSWORD\": \"********\"}\n    )\n\nrun_soda_scan()\n```\n\n## Resources\n\nIf you encounter any bugs while using `prefect-soda-core`, feel free to open an issue in the [prefect-soda-core](https://github.com/sodadata/prefect-soda-core) repository.\n\nIf you have any questions or issues while using `prefect-soda-core`, you can find help in either the [Prefect Discourse forum](https://discourse.prefect.io/) or the [Prefect Slack community](https://prefect.io/slack).\n\n## Development\n\nIf you'd like to install a version of `prefect-soda-core` for development, clone the repository and perform an editable install with `pip`:\n\n```bash\ngit clone https://github.com/sodadata/prefect-soda-core.git\n\ncd prefect-soda-core/\n\npip install -e \".[dev]\"\n\n# Install linting pre-commit hooks\npre-commit install\n```\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Prefect 2.0 collection for Soda Core",
    "version": "0.1.8",
    "project_urls": {
        "Homepage": "https://github.com/sodadata/prefect-soda-core"
    },
    "split_keywords": [
        "prefect"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85f0a9f206f4b42c57cd31b3d5a36816bd5bf2b59f22b754ff62e1430743471a",
                "md5": "ad61821079036aea09f441bf37168c9f",
                "sha256": "252faece1e2c527abeff9c1ba2a297d75f8f3f7c129d6f2bcc147b487606dbcd"
            },
            "downloads": -1,
            "filename": "prefect_soda_core-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ad61821079036aea09f441bf37168c9f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12402,
            "upload_time": "2023-12-12T08:27:29",
            "upload_time_iso_8601": "2023-12-12T08:27:29.679686Z",
            "url": "https://files.pythonhosted.org/packages/85/f0/a9f206f4b42c57cd31b3d5a36816bd5bf2b59f22b754ff62e1430743471a/prefect_soda_core-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "887275a4fb5e037f40b96d9b0f2d1e5b0f86de45f4e385ea2e816f45459c05db",
                "md5": "8ed1addec6ce07b2ab5d305336dab839",
                "sha256": "c660e4cbaa8cf4fd79128d18fad8f1ccd6d14d7288d25a6025574cbea30b2ada"
            },
            "downloads": -1,
            "filename": "prefect-soda-core-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "8ed1addec6ce07b2ab5d305336dab839",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 28617,
            "upload_time": "2023-12-12T08:27:30",
            "upload_time_iso_8601": "2023-12-12T08:27:30.871461Z",
            "url": "https://files.pythonhosted.org/packages/88/72/75a4fb5e037f40b96d9b0f2d1e5b0f86de45f4e385ea2e816f45459c05db/prefect-soda-core-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-12 08:27:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sodadata",
    "github_project": "prefect-soda-core",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "prefect-soda-core"
}
        
Elapsed time: 0.14664s