Skip to content

Project fails to load when model names contain backticks, asterisk or quotes #3

@giovannipcarvalho

Description

@giovannipcarvalho

First of all, thanks for tackling this integration. This is huge!

--

I'm trying it out with our sqlmesh project and it fails due to some of our (external) models having unusual naming.

The external model is actually a set of tables named:

  • analytics_12345.events_20240925
  • analytics_12345.events_20240926
  • ...

So far, nothing unusual here, but to facilitate local development we mock these tables as a single table in duckdb. And to make our external-model schema work in both cases (multiple tables in bigquery vs a single table in duckdb), we declare it as:

# file: external_models/bigquery_ga4_export_schema.yaml
- name: 'analytics_12345.`events_*`'
  columns:
[...] 

(The table in duckdb actually contains an * in its name, and not as a wildcard.)

That's when things get messy (we also had trouble with sqlmesh initially, but it now supports these).

In short, our external models contain backticks, stars and quotes (when normalized by sqlmesh).

I've checked that replacing these extra characters makes our project load just fine. I'm happy to contribute a patch, but first would like to know how you'd want these handled. Just naively adding more string replacements to sqlmesh_model_name_to_key and key_to_sqlmesh_model_name seems like a recipe for disaster.

--

Error message:

dagster._core.errors.DagsterInvalidDefinitionError: "analytics_12345_dot__`events_*`" is not a valid name in Dagster. Names must be in regex ^[A-Za-z0-9_]+$.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions