Skip to content

Commit 219046b

Browse files
committed
Rename example_project module, capitalize class constants
1 parent 1fb7031 commit 219046b

15 files changed

Lines changed: 66 additions & 68 deletions

File tree

sqlmesh/cli/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from sqlmesh import configure_logging, remove_excess_logs
1010
from sqlmesh.cli import error_handler
1111
from sqlmesh.cli import options as opt
12-
from sqlmesh.cli.example_project import (
12+
from sqlmesh.cli.project_init import (
1313
ProjectTemplate,
1414
init_example_project,
1515
InitCliMode,
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,11 @@ def _gen_config(
122122
default_configs[ProjectTemplate.DLT] = default_configs[ProjectTemplate.DEFAULT]
123123

124124
simple_cli_mode = """
125-
# --- SIMPLE CLI MODE ---
126125
# Minimal prompts, automatic changes, summary output
127126
# https://sqlmesh.readthedocs.io/en/stable/reference/configuration/#plan
128127
129128
plan:
130129
no_diff: true # Hide detailed text differences for changed models
131-
use_finalized_state: true # Compare only against finalized snapshots
132130
no_prompts: true # No interactive prompts
133131
auto_apply: true # Apply changes automatically
134132

sqlmesh/core/config/connection.py

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ def validate(cls: t.Any, data: t.Any) -> t.Any:
8787

8888
class ConnectionConfig(abc.ABC, BaseConfig):
8989
type_: str
90-
dialect: t.ClassVar[str]
91-
display_name: t.ClassVar[str]
92-
display_order: t.ClassVar[int]
90+
DIALECT: t.ClassVar[str]
91+
DISPLAY_NAME: t.ClassVar[str]
92+
DISPLAY_ORDER: t.ClassVar[int]
9393
concurrent_tasks: int
9494
register_comments: bool
9595
pre_ping: bool
@@ -466,9 +466,9 @@ class MotherDuckConnectionConfig(BaseDuckDBConnectionConfig):
466466
"""Configuration for the MotherDuck connection."""
467467

468468
type_: t.Literal["motherduck"] = Field(alias="type", default="motherduck")
469-
dialect: t.ClassVar[t.Literal["duckdb"]] = "duckdb"
470-
display_name: t.ClassVar[t.Literal["MotherDuck"]] = "MotherDuck"
471-
display_order: t.ClassVar[t.Literal[5]] = 5
469+
DIALECT: t.ClassVar[t.Literal["duckdb"]] = "duckdb"
470+
DISPLAY_NAME: t.ClassVar[t.Literal["MotherDuck"]] = "MotherDuck"
471+
DISPLAY_ORDER: t.ClassVar[t.Literal[5]] = 5
472472

473473
@property
474474
def _connection_kwargs_keys(self) -> t.Set[str]:
@@ -493,9 +493,9 @@ class DuckDBConnectionConfig(BaseDuckDBConnectionConfig):
493493
"""Configuration for the DuckDB connection."""
494494

495495
type_: t.Literal["duckdb"] = Field(alias="type", default="duckdb")
496-
dialect: t.ClassVar[t.Literal["duckdb"]] = "duckdb"
497-
display_name: t.ClassVar[t.Literal["DuckDB"]] = "DuckDB"
498-
display_order: t.ClassVar[t.Literal[1]] = 1
496+
DIALECT: t.ClassVar[t.Literal["duckdb"]] = "duckdb"
497+
DISPLAY_NAME: t.ClassVar[t.Literal["DuckDB"]] = "DuckDB"
498+
DISPLAY_ORDER: t.ClassVar[t.Literal[1]] = 1
499499

500500

501501
class SnowflakeConnectionConfig(ConnectionConfig):
@@ -546,9 +546,9 @@ class SnowflakeConnectionConfig(ConnectionConfig):
546546
session_parameters: t.Optional[dict] = None
547547

548548
type_: t.Literal["snowflake"] = Field(alias="type", default="snowflake")
549-
dialect: t.ClassVar[t.Literal["snowflake"]] = "snowflake"
550-
display_name: t.ClassVar[t.Literal["Snowflake"]] = "Snowflake"
551-
display_order: t.ClassVar[t.Literal[2]] = 2
549+
DIALECT: t.ClassVar[t.Literal["snowflake"]] = "snowflake"
550+
DISPLAY_NAME: t.ClassVar[t.Literal["Snowflake"]] = "Snowflake"
551+
DISPLAY_ORDER: t.ClassVar[t.Literal[2]] = 2
552552

553553
_concurrent_tasks_validator = concurrent_tasks_validator
554554

@@ -745,9 +745,9 @@ class DatabricksConnectionConfig(ConnectionConfig):
745745
pre_ping: t.Literal[False] = False
746746

747747
type_: t.Literal["databricks"] = Field(alias="type", default="databricks")
748-
dialect: t.ClassVar[t.Literal["databricks"]] = "databricks"
749-
display_name: t.ClassVar[t.Literal["Databricks"]] = "Databricks"
750-
display_order: t.ClassVar[t.Literal[3]] = 3
748+
DIALECT: t.ClassVar[t.Literal["databricks"]] = "databricks"
749+
DISPLAY_NAME: t.ClassVar[t.Literal["Databricks"]] = "Databricks"
750+
DISPLAY_ORDER: t.ClassVar[t.Literal[3]] = 3
751751

752752
_concurrent_tasks_validator = concurrent_tasks_validator
753753
_http_headers_validator = http_headers_validator
@@ -1004,9 +1004,9 @@ class BigQueryConnectionConfig(ConnectionConfig):
10041004
pre_ping: t.Literal[False] = False
10051005

10061006
type_: t.Literal["bigquery"] = Field(alias="type", default="bigquery")
1007-
dialect: t.ClassVar[t.Literal["bigquery"]] = "bigquery"
1008-
display_name: t.ClassVar[t.Literal["BigQuery"]] = "BigQuery"
1009-
display_order: t.ClassVar[t.Literal[4]] = 4
1007+
DIALECT: t.ClassVar[t.Literal["bigquery"]] = "bigquery"
1008+
DISPLAY_NAME: t.ClassVar[t.Literal["BigQuery"]] = "BigQuery"
1009+
DISPLAY_ORDER: t.ClassVar[t.Literal[4]] = 4
10101010

10111011
_engine_import_validator = _get_engine_import_validator("google.cloud.bigquery", "bigquery")
10121012

@@ -1149,9 +1149,9 @@ class GCPPostgresConnectionConfig(ConnectionConfig):
11491149
driver: str = "pg8000"
11501150

11511151
type_: t.Literal["gcp_postgres"] = Field(alias="type", default="gcp_postgres")
1152-
dialect: t.ClassVar[t.Literal["postgres"]] = "postgres"
1153-
display_name: t.ClassVar[t.Literal["GCP Postgres"]] = "GCP Postgres"
1154-
display_order: t.ClassVar[t.Literal[13]] = 13
1152+
DIALECT: t.ClassVar[t.Literal["postgres"]] = "postgres"
1153+
DISPLAY_NAME: t.ClassVar[t.Literal["GCP Postgres"]] = "GCP Postgres"
1154+
DISPLAY_ORDER: t.ClassVar[t.Literal[13]] = 13
11551155

11561156
concurrent_tasks: int = 4
11571157
register_comments: bool = True
@@ -1287,9 +1287,9 @@ class RedshiftConnectionConfig(ConnectionConfig):
12871287
pre_ping: bool = False
12881288

12891289
type_: t.Literal["redshift"] = Field(alias="type", default="redshift")
1290-
dialect: t.ClassVar[t.Literal["redshift"]] = "redshift"
1291-
display_name: t.ClassVar[t.Literal["Redshift"]] = "Redshift"
1292-
display_order: t.ClassVar[t.Literal[7]] = 7
1290+
DIALECT: t.ClassVar[t.Literal["redshift"]] = "redshift"
1291+
DISPLAY_NAME: t.ClassVar[t.Literal["Redshift"]] = "Redshift"
1292+
DISPLAY_ORDER: t.ClassVar[t.Literal[7]] = 7
12931293

12941294
_engine_import_validator = _get_engine_import_validator("redshift_connector", "redshift")
12951295

@@ -1351,9 +1351,9 @@ class PostgresConnectionConfig(ConnectionConfig):
13511351
pre_ping: bool = True
13521352

13531353
type_: t.Literal["postgres"] = Field(alias="type", default="postgres")
1354-
dialect: t.ClassVar[t.Literal["postgres"]] = "postgres"
1355-
display_name: t.ClassVar[t.Literal["Postgres"]] = "Postgres"
1356-
display_order: t.ClassVar[t.Literal[12]] = 12
1354+
DIALECT: t.ClassVar[t.Literal["postgres"]] = "postgres"
1355+
DISPLAY_NAME: t.ClassVar[t.Literal["Postgres"]] = "Postgres"
1356+
DISPLAY_ORDER: t.ClassVar[t.Literal[12]] = 12
13571357

13581358
_engine_import_validator = _get_engine_import_validator("psycopg2", "postgres")
13591359

@@ -1407,9 +1407,9 @@ class MySQLConnectionConfig(ConnectionConfig):
14071407
pre_ping: bool = True
14081408

14091409
type_: t.Literal["mysql"] = Field(alias="type", default="mysql")
1410-
dialect: t.ClassVar[t.Literal["mysql"]] = "mysql"
1411-
display_name: t.ClassVar[t.Literal["MySQL"]] = "MySQL"
1412-
display_order: t.ClassVar[t.Literal[14]] = 14
1410+
DIALECT: t.ClassVar[t.Literal["mysql"]] = "mysql"
1411+
DISPLAY_NAME: t.ClassVar[t.Literal["MySQL"]] = "MySQL"
1412+
DISPLAY_ORDER: t.ClassVar[t.Literal[14]] = 14
14131413

14141414
_engine_import_validator = _get_engine_import_validator("pymysql", "mysql")
14151415

@@ -1472,9 +1472,9 @@ class MSSQLConnectionConfig(ConnectionConfig):
14721472
pre_ping: bool = True
14731473

14741474
type_: t.Literal["mssql"] = Field(alias="type", default="mssql")
1475-
dialect: t.ClassVar[t.Literal["tsql"]] = "tsql"
1476-
display_name: t.ClassVar[t.Literal["MSSQL"]] = "MSSQL"
1477-
display_order: t.ClassVar[t.Literal[11]] = 11
1475+
DIALECT: t.ClassVar[t.Literal["tsql"]] = "tsql"
1476+
DISPLAY_NAME: t.ClassVar[t.Literal["MSSQL"]] = "MSSQL"
1477+
DISPLAY_ORDER: t.ClassVar[t.Literal[11]] = 11
14781478

14791479
@model_validator(mode="before")
14801480
@classmethod
@@ -1616,8 +1616,8 @@ def _extra_engine_config(self) -> t.Dict[str, t.Any]:
16161616

16171617
class AzureSQLConnectionConfig(MSSQLConnectionConfig):
16181618
type_: t.Literal["azuresql"] = Field(alias="type", default="azuresql") # type: ignore
1619-
display_name: t.ClassVar[t.Literal["Azure SQL"]] = "Azure SQL" # type: ignore
1620-
display_order: t.ClassVar[t.Literal[10]] = 10 # type: ignore
1619+
DISPLAY_NAME: t.ClassVar[t.Literal["Azure SQL"]] = "Azure SQL" # type: ignore
1620+
DISPLAY_ORDER: t.ClassVar[t.Literal[10]] = 10 # type: ignore
16211621

16221622
@property
16231623
def _extra_engine_config(self) -> t.Dict[str, t.Any]:
@@ -1638,9 +1638,9 @@ class SparkConnectionConfig(ConnectionConfig):
16381638
pre_ping: t.Literal[False] = False
16391639

16401640
type_: t.Literal["spark"] = Field(alias="type", default="spark")
1641-
dialect: t.ClassVar[t.Literal["spark"]] = "spark"
1642-
display_name: t.ClassVar[t.Literal["Spark"]] = "Spark"
1643-
display_order: t.ClassVar[t.Literal[8]] = 8
1641+
DIALECT: t.ClassVar[t.Literal["spark"]] = "spark"
1642+
DISPLAY_NAME: t.ClassVar[t.Literal["Spark"]] = "Spark"
1643+
DISPLAY_ORDER: t.ClassVar[t.Literal[8]] = 8
16441644

16451645
_engine_import_validator = _get_engine_import_validator("pyspark", "spark")
16461646

@@ -1759,9 +1759,9 @@ class TrinoConnectionConfig(ConnectionConfig):
17591759
pre_ping: t.Literal[False] = False
17601760

17611761
type_: t.Literal["trino"] = Field(alias="type", default="trino")
1762-
dialect: t.ClassVar[t.Literal["trino"]] = "trino"
1763-
display_name: t.ClassVar[t.Literal["Trino"]] = "Trino"
1764-
display_order: t.ClassVar[t.Literal[9]] = 9
1762+
DIALECT: t.ClassVar[t.Literal["trino"]] = "trino"
1763+
DISPLAY_NAME: t.ClassVar[t.Literal["Trino"]] = "Trino"
1764+
DISPLAY_ORDER: t.ClassVar[t.Literal[9]] = 9
17651765

17661766
_engine_import_validator = _get_engine_import_validator("trino", "trino")
17671767

@@ -1922,9 +1922,9 @@ class ClickhouseConnectionConfig(ConnectionConfig):
19221922
connection_pool_options: t.Optional[t.Dict[str, t.Any]] = None
19231923

19241924
type_: t.Literal["clickhouse"] = Field(alias="type", default="clickhouse")
1925-
dialect: t.ClassVar[t.Literal["clickhouse"]] = "clickhouse"
1926-
display_name: t.ClassVar[t.Literal["ClickHouse"]] = "ClickHouse"
1927-
display_order: t.ClassVar[t.Literal[6]] = 6
1925+
DIALECT: t.ClassVar[t.Literal["clickhouse"]] = "clickhouse"
1926+
DISPLAY_NAME: t.ClassVar[t.Literal["ClickHouse"]] = "ClickHouse"
1927+
DISPLAY_ORDER: t.ClassVar[t.Literal[6]] = 6
19281928

19291929
_engine_import_validator = _get_engine_import_validator("clickhouse_connect", "clickhouse")
19301930

@@ -2049,9 +2049,9 @@ class AthenaConnectionConfig(ConnectionConfig):
20492049
pre_ping: t.Literal[False] = False
20502050

20512051
type_: t.Literal["athena"] = Field(alias="type", default="athena")
2052-
dialect: t.ClassVar[t.Literal["athena"]] = "athena"
2053-
display_name: t.ClassVar[t.Literal["Athena"]] = "Athena"
2054-
display_order: t.ClassVar[t.Literal[15]] = 15
2052+
DIALECT: t.ClassVar[t.Literal["athena"]] = "athena"
2053+
DISPLAY_NAME: t.ClassVar[t.Literal["Athena"]] = "Athena"
2054+
DISPLAY_ORDER: t.ClassVar[t.Literal[15]] = 15
20552055

20562056
_engine_import_validator = _get_engine_import_validator("pyathena", "athena")
20572057

@@ -2120,9 +2120,9 @@ class RisingwaveConnectionConfig(ConnectionConfig):
21202120
pre_ping: bool = True
21212121

21222122
type_: t.Literal["risingwave"] = Field(alias="type", default="risingwave")
2123-
dialect: t.ClassVar[t.Literal["risingwave"]] = "risingwave"
2124-
display_name: t.ClassVar[t.Literal["RisingWave"]] = "RisingWave"
2125-
display_order: t.ClassVar[t.Literal[16]] = 16
2123+
DIALECT: t.ClassVar[t.Literal["risingwave"]] = "risingwave"
2124+
DISPLAY_NAME: t.ClassVar[t.Literal["RisingWave"]] = "RisingWave"
2125+
DISPLAY_ORDER: t.ClassVar[t.Literal[16]] = 16
21262126

21272127
_engine_import_validator = _get_engine_import_validator("psycopg2", "risingwave")
21282128

@@ -2168,7 +2168,7 @@ def init(cursor: t.Any) -> None:
21682168
}
21692169

21702170
DIALECT_TO_TYPE = {
2171-
tpe.all_field_infos()["type_"].default: tpe.dialect
2171+
tpe.all_field_infos()["type_"].default: tpe.DIALECT
21722172
for tpe in subclasses(
21732173
__name__,
21742174
ConnectionConfig,
@@ -2178,8 +2178,8 @@ def init(cursor: t.Any) -> None:
21782178

21792179
INIT_DISPLAY_INFO_TO_TYPE = {
21802180
tpe.all_field_infos()["type_"].default: (
2181-
tpe.display_order,
2182-
tpe.display_name,
2181+
tpe.DISPLAY_ORDER,
2182+
tpe.DISPLAY_NAME,
21832183
)
21842184
for tpe in subclasses(
21852185
__name__,

sqlmesh/integrations/dlt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def generate_dlt_models(
138138
force: bool,
139139
dlt_path: t.Optional[str] = None,
140140
) -> t.List[str]:
141-
from sqlmesh.cli.example_project import _create_models
141+
from sqlmesh.cli.project_init import _create_models
142142

143143
sqlmesh_models, _, _ = generate_dlt_models_and_settings(
144144
pipeline_name=pipeline_name,

sqlmesh/magics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring
2525
from IPython.utils.process import arg_split
2626
from rich.jupyter import JupyterRenderable
27-
from sqlmesh.cli.example_project import ProjectTemplate, init_example_project
27+
from sqlmesh.cli.project_init import ProjectTemplate, init_example_project
2828
from sqlmesh.core import analytics
2929
from sqlmesh.core.config import load_configs
3030
from sqlmesh.core.config.connection import INIT_DISPLAY_INFO_TO_TYPE

tests/cli/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import json
1212
from unittest.mock import MagicMock
1313
from sqlmesh import RuntimeEnv
14-
from sqlmesh.cli.example_project import ProjectTemplate, init_example_project
14+
from sqlmesh.cli.project_init import ProjectTemplate, init_example_project
1515
from sqlmesh.cli.main import cli
1616
from sqlmesh.core.context import Context
1717
from sqlmesh.integrations.dlt import generate_dlt_models

tests/cli/test_integration_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33
import pytest
44
import subprocess
5-
from sqlmesh.cli.example_project import init_example_project
5+
from sqlmesh.cli.project_init import init_example_project
66
from sqlmesh.utils import yaml
77
import shutil
88
import site

tests/core/engine_adapter/integration/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from sqlglot.optimizer.normalize_identifiers import normalize_identifiers
1818

1919
from sqlmesh import Config, Context
20-
from sqlmesh.cli.example_project import init_example_project
20+
from sqlmesh.cli.project_init import init_example_project
2121
from sqlmesh.core.config import load_config_from_paths
2222
from sqlmesh.core.config.connection import ConnectionConfig
2323
import sqlmesh.core.dialect as d

tests/core/engine_adapter/integration/test_integration_bigquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from sqlglot import exp
55
from sqlglot.optimizer.qualify_columns import quote_identifiers
66
from sqlglot.helper import seq_get
7-
from sqlmesh.cli.example_project import ProjectTemplate, init_example_project
7+
from sqlmesh.cli.project_init import ProjectTemplate, init_example_project
88
from sqlmesh.core.config import Config
99
from sqlmesh.core.engine_adapter import BigQueryEngineAdapter
1010
from sqlmesh.core.engine_adapter.bigquery import _CLUSTERING_META_KEY

tests/core/state_sync/test_export_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from sqlmesh.core.state_sync.export_import import export_state, import_state
55
from sqlmesh.utils.errors import SQLMeshError
66
from sqlmesh.core import constants as c
7-
from sqlmesh.cli.example_project import init_example_project
7+
from sqlmesh.cli.project_init import init_example_project
88
from sqlmesh.core.context import Context
99
from sqlmesh.core.environment import Environment
1010
from sqlmesh.core.config import Config, GatewayConfig, DuckDBConnectionConfig, ModelDefaultsConfig

0 commit comments

Comments
 (0)