Repository navigation
Add Snowflake → OSI import converter (snowflake_to_osi) - #163
sudulakuntanithin wants to merge 1 commit into
Conversation
| def _warn_dropped_fields(source, context): | ||
| """Warns about Snowflake fields that have no OSI counterpart. | ||
|
|
||
| These are fields that exist in the Snowflake model but should not be | ||
| dropped silently; they should be captured in custom_extensions or | ||
| explicitly warned about. | ||
| """ | ||
| # Snowflake-specific fields that don't map to OSI and weren't handled: | ||
| # - warehouse, database, schema (table-level config) | ||
| # - any other vendor-specific fields (these should be in custom_extensions now) | ||
|
|
||
| # For now, we don't warn about anything here since we capture all unknown | ||
| # fields in custom_extensions. The warning is implicit in the custom_extensions. |
There was a problem hiding this comment.
This method looks empty ? Do you want to track this issue for follow up ?
| # - filters: Snowflake-specific row-level security filters | ||
| # - tags: Snowflake tags for metadata (preserved in custom_extensions as vendor-specific) |
There was a problem hiding this comment.
How are filters and tags mapped to OSI fields ?
|
Can you please rebase and resolve conflict? |
|
Any update from the author? @sudulakuntanithin ? |
|
@jbonofre happy to pick this up if the author doesn't come back. Heads up that it needs more than a rebase — #228 moved the converter into @sudulakuntanithin it's yours if you're still on it. I asked on #162 back in August and |
|
@RyutoYoda please! It's up to you, I can tackle this one as well. You call 😄 |
|
@jbonofre thanks, I'll take it. Opened as two PRs: #566 renames @sudulakuntanithin thanks for the original pass here -- the mapping shape in |
Closes #162.
Adds the import direction for the Snowflake converter: snowflake_to_osi_yaml_converter.py, converting Snowflake Cortex Analyst semantic view YAML into OSI. The converters/snowflake/ directory previously shipped only osi_to_snowflake (export); this completes the bidirectional pair, consistent with the converter guide and roadmap.
Mapping (verified against the official semantic view YAML spec):
tables → datasets; base_table ({database, schema, table}) → source
dimensions / time_dimensions / facts → fields (with dimension.is_time set appropriately)
Both table-level and view-level metrics → OSI top-level metrics
relationships (left_table/right_table, relationship_columns) → from/to/from_columns/to_columns
Snowflake-specific settings preserved in custom_extensions (vendor_name: SNOWFLAKE); unmapped constructs raise warnings rather than failing silently
Testing:
117 tests pass (pytest tests/), including unit, integration, and a round-trip test through the existing exporter
Output validates against osi-schema.json, including sqlglot SQL validation
CLI mirrors the existing converter: python3 src/snowflake_to_osi_yaml_converter.py -i input.yaml -o output.yaml
Notes / open questions for maintainers:
On duplicate metric names (table-level vs. derived), the converter keeps the first and warns — happy to change to name-qualification if preferred.
README updated to document both directions.