Skip to main content

No project description provided

Project description

dagster-pydantic

This is a naive approach for using Pydantic types for Dagster Type Checking. The package dagster_pydantic includes a really simple validation factory. Pydanitc is not built as a data validation library, it's actually a great parser and an OK validator in that order.

The purpose of this validation step is to ensure the shape of the model is correct before the data is consumed by the next op. Pydantic will stop you during the instantiation of your model if the data is not up to spec but if you want to check if the shape of the parsed data will match the model, that's where the validation layer comes in.

Usage

class MyPydanticModel(BaseModel):
    """
    This is a Pydantic model.
    """
    a: int
    b: str


MyPydanticModelDT = pydantic_to_dagster_type(MyPydanticModel)

@op(out=Out(MyPydanticModelDT))
def get_model():
    model = MyPydanticModel(
        a = 1,
        b = "hello"
    )
    # This should fail type checking in the Dagit UI.
    model.b = {} # type: ignore
    return model

This code will result in:

A typechecking error in the dagit UI

Without this integration, you wouldn't see that typechecking error in the console and the next op will consume a dict in place of a str.

Developing

First, install Just

$ just install

This will run two poetry commands in your current terminal, one that configures venvs to be in the project directory so the dependencies are accessable from your local environment. The other will install the dependencies.

$ just shell

This opens a current shell into your poetry virtual env.

Running tests

$ just test # This only runs pytest

Disclaimer

I've only had my hands on Dagster for a few weeks. I love the declarative framework, and the focus on flexibility + developer velocity. I am a bit iffy on the pricing and what's offered in the "Standard plan", but otherwise I'm so impressed by the open-source project.

That being said, I'm a noobie. This is my first integration and also my first Python module, so feel free to drop an issue if there's something I'm missing.

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

dagster_pydantic-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

dagster_pydantic-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file dagster_pydantic-0.1.0.tar.gz.

File metadata

  • Download URL: dagster_pydantic-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.1 Darwin/21.3.0

File hashes

Hashes for dagster_pydantic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a120bb79290de6764b6daaf231d0ca62c3f1913f627c6c77d0ec143437e3dc95
MD5 d1d02694a2bee5c3aa1e5e9307e01ae7
BLAKE2b-256 f62132d76a6e64ae10b3058614577ef3715a64d0072ec98352e1823822e8de62

See more details on using hashes here.

File details

Details for the file dagster_pydantic-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dagster_pydantic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3af527296f414fa16be865cdef3d7acb3deefad43465a9b526b13f90ae349ae
MD5 6869380a7906e4dad2f1cda8aac82038
BLAKE2b-256 bd325b6a4dca2ceb4c379820469a5b7d53ca186cced8870a4081b14dc0c60955

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