Allow overriding the virtual layer schema name directly, not just via suffix mode

Abierto
#5,955 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python
Área
databases

Línea de trabajo

Start by reading sqlmesh/core/snapshot/definition.py, especially schema_name_for_environment, and trace how environment_suffix_target and physical_schema_mapping are configured and tested. Then identify the relevant configuration and snapshot tests; done means a configurable virtual schema mapping supports custom non-production names while existing suffix modes remain unchanged by default.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem

environment_suffix_target (schema/table/catalog) always appends the environment
name as a fixed suffix: f"{schema}__{env_name}" in
sqlmesh/core/snapshot/definition.py (schema_name_for_environment). There's no
way to control the resulting name beyond choosing which of the three levels gets
the suffix.

This is inconsistent with the physical layer, where physical_schema_mapping
already lets you map a model's schema (by regex) to an arbitrary target schema
name of your choosing.

Use case

Our org has an existing naming convention for personal/ad hoc schemas:
dev_<user> as a prefix. We can already point a model's physical table
anywhere via physical_schema_mapping, but the virtual layer view for a dev
environment is always <model_schema>__dev_<user> (suffix), which we can't
make consistent with our naming convention. environment_suffix_target: table
and : catalog don't help either, they move where the suffix goes, but it's
still always a suffix.

Proposal

Add a config option (e.g. a virtual_schema_mapping, analogous to
physical_schema_mapping) that lets users map a model's schema name to an
arbitrary virtual schema name/template for non-prod environments, instead of
being limited to the fixed <schema>__<environment> formula.

Default behavior (schema/table/catalog suffix modes) would stay unchanged for
anyone not setting this.

Lenguaje dominante
Python
Estrellas
3.3k
Forks
471
Merge medio
6 d 7 h
PR fusionados (30 d)
35

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de SQLMesh/sqlmesh

Todos los issues de SQLMesh/sqlmesh

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.