Skills
A skill is a package of structured files that teaches an AI coding agent how to work with a specific tool or framework. The skill below was generated by Great Docs from this project’s documentation. Install it in your agent and it will be able to run commands, edit configuration, write content, and troubleshoot problems without step-by-step guidance from you.
Any agent — install with npx:
npx skills add https://ozanozbeker.com/dagster-dataframely/Codex / OpenCode
Tell the agent:
Fetch the skill file at https://ozanozbeker.com/dagster-dataframely/skill.md and follow the instructions.Manual — download the skill file:
curl -O https://ozanozbeker.com/dagster-dataframely/skill.mdOr browse the SKILL.md file.
SKILL.md
--- name: dagster-dataframely description: > Attach a Dataframely schema to a Dagster asset. Use when writing Python code that uses the dagster_dataframely package. license: Apache-2.0 compatibility: Requires Python >=3.12. --- # dagster_dataframely Attach a Dataframely schema to a Dagster asset. ## Installation ```bash pip install dagster-dataframely ``` ## When to use what | Need | Use | |------|-----| | Validate the frame an asset returns, and fill its Columns tab | `@dd.asset(OrdersSchema)` | | Write the rows that fail an "error" rule to a table instead of failing the run | `@dd.asset(OrdersSchema, filter=True)` | | Put the error rows in the asset graph | `dd.build_error_rows_spec(OrdersSchema, orders)` | | Check a table that dd.asset did not build | `dd.build_rule_checks(OrdersSchema, asset="warehouse_orders")` | | Report a Collection's collection filters as checks | `dd.build_collection_checks(Shop, members={...})` | | Read what a direct invocation yielded in a test | `dd.testing.DirectInvocationResult.from_invocation(orders(dg.build_asset_context(), frame))` | | Build a @dg.asset from the parts yourself | `dd.wiring` | ## API overview ### Core `dd.asset` builds an asset from a schema, and `build_error_rows_spec` adds that asset's error rows to the asset graph. `build_collection_checks` returns asset checks that report a Collection's collection filters on its member assets. `build_rule_checks` returns asset checks that report a schema's rules on an asset `dd.asset` did not build. - `asset`: Turn the decorated function into an asset that validates the frame it returns against `schema` - `build_error_rows_spec`: Return an asset spec that adds an asset's error rows to the asset graph - `build_collection_checks`: Return an asset check for each collection filter of `collection` on each of its member assets - `build_rule_checks`: Return an asset check for each of the schema's rules on `asset`, plus the column-schema check - `Granularity`: Type alias ### Data `OrdersSchema`, `storefront_orders` and `marketplace_orders` are the example data that most examples on this site use, and `ParquetIOManager` is the IO manager they write through. The package ships them, so an example copied from an editor hover runs as written. - `data.OrdersSchema` - `data.storefront_orders` - `data.marketplace_orders` - `data.ParquetIOManager` ### Testing `DirectInvocationResult.from_invocation` separates what a direct invocation of an asset built with `dd.asset` yields into its materialization and its check results. - `testing.DirectInvocationResult` ### Hand-wiring `dd.asset` calls most of these functions. Use them to build a `@dg.asset` that `dd.asset` cannot build. - `wiring.get_column_schema_metadata` - `wiring.get_table_schema` - `wiring.get_code_version` - `wiring.build_asset_check_specs` - `wiring.evaluate_checks` - `wiring.get_check_name_for_rule` - `wiring.stream_results` - `wiring.ErrorRowsWriter` - `wiring.build_io_manager_writer` - `wiring.build_file_writer` - `wiring.get_error_rows` - `wiring.get_error_rows_key` - `wiring.get_error_rows_path` - `wiring.validate_error_rows_key` ### Errors `DagsterDataframelyError` is the base class of every other error this package defines. - `errors.DagsterDataframelyError` - `errors.CollectionNotSupportedError` - `errors.InvalidMembersError` - `errors.FailurePropagationError` - `errors.ReservedColumnError` - `errors.InvalidColumnNameError` - `errors.CheckNameCollisionError` - `errors.InvalidSeverityError` - `errors.InvalidSettingError` - `errors.MaterializeResultValueError` - `errors.MaterializeResultFieldError` - `errors.ColumnSchemaError` - `errors.ValidationAbortError` - `errors.NoValidRowsError` - `errors.ErrorRowsKeyCollisionError` - `errors.ErrorRowsDirError` ## Gotchas 1. The decorated function must return a frame with the schema's dtypes. The package never casts, so a dtype that differs fails the run before `Schema.filter` runs. 2. Write the values of Polars' `is_in` in a `check=` or a `@dy.rule()` as a list, not a set of strings. Python orders a set of strings differently in each process, so the code version changes each time the code location starts. 3. Returning `dg.MaterializeResult(value=None)` raises `MaterializeResultValueError`. To skip, return `None` itself. 4. A Polars upgrade can change every asset's code version at once, because the hash uses Polars' expression serialization. 5. Every `dd.asset` takes a `context` parameter, so a direct invocation passes `dg.build_asset_context()` first. 6. A direct invocation with error rows needs `DAGSTER_DATAFRAMELY_ERROR_ROWS_DIR`, or it raises `ErrorRowsDirError`. 7. `DAGSTER_DATAFRAMELY_STATISTICS` accepts only `true` or `false`, in any letter case. `1`, `yes` and `on` raise `InvalidSettingError`. ## Best practices - Import the module, not the name: `import dagster_dataframely as dd`, then `@dd.asset`. A bare `asset` reads as Dagster's. - Name a `dy.Schema` subclass with the `Schema` suffix, as Dataframely does: `OrdersSchema` is the schema, `orders` is the asset. - To try the package, use `dd.data.OrdersSchema`, `dd.data.storefront_orders` and `dd.data.marketplace_orders`, so your output matches the examples in the documentation. - Pin to one minor version before 1.0, and read [Upgrading](https://ozanozbeker.com/dagster-dataframely/user-guide/upgrading.html) before moving to the next. ## Resources - [Full documentation](https://ozanozbeker.com/dagster-dataframely/) - [llms.txt](llms.txt) — Indexed API reference for LLMs - [llms-full.txt](llms-full.txt) — Comprehensive documentation for LLMs - [Source code](https://github.com/ozanozbeker/dagster-dataframely)