Skip to content

Commit c197c21

Browse files
committed
Config guide edits
1 parent 62ada5b commit c197c21

3 files changed

Lines changed: 6 additions & 18 deletions

File tree

docs/guides/configuration.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,11 @@ In some organizations, users never run plans directly against `prod` - they do a
159159

160160
If your organization works like this, it may be convenient to change the `plan` command's default environment from `prod` to each user's development environment. That way people can issue `sqlmesh plan` without typing the environment name every time.
161161

162-
The SQLMesh configuration `user()` function returns the name of the user currently logged in and running SQLMesh. Call it inside Jinja curly braces to use default target environments based on the user name. The curly braces allow you to combine the user name with a prefix or suffix.
162+
The SQLMesh configuration `user()` function returns the name of the user currently logged in and running SQLMesh. It retrieves the username from system environment variables like `USER` on MacOS/Linux or `USERNAME` on Windows.
163163

164-
The example configuration below will add the username to the end of the string `dev_`. If the user running SQLMesh is `tony`, the default target environment when they run SQLMesh will be `dev_tony`. In other words, `sqlmesh plan` will be equivalent to `sqlmesh plan dev_tony`.
164+
Call `user()` inside Jinja curly braces with the syntax `{{ user() }}`, which allows you to combine the user name with a prefix or suffix.
165+
166+
The example configuration below constructs the environment name by appending the username to the end of the string `dev_`. If the user running SQLMesh is `tony`, the default target environment when they run SQLMesh will be `dev_tony`. In other words, `sqlmesh plan` will be equivalent to `sqlmesh plan dev_tony`.
165167

166168
=== "YAML"
167169

sqlmesh/cli/main.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,20 +1286,6 @@ def state_import(obj: Context, input_file: Path, replace: bool, no_confirm: bool
12861286
obj.import_state(input_file=input_file, clear=replace, confirm=confirm)
12871287

12881288

1289-
def _check_engine_installed(console: Console, engine_type: t.Optional[str] = None) -> None:
1290-
if not engine_type:
1291-
return
1292-
connection_config = CONNECTION_CONFIG_TO_TYPE[engine_type]
1293-
1294-
try:
1295-
connection_config._connection_factory.fget(None)
1296-
except ModuleNotFoundError:
1297-
install_command = f'pip install "sqlmesh[{engine_type}]"'
1298-
raise SQLMeshError(
1299-
f"Unable to load required Python dependencies for the {DISPLAY_NAME_TO_TYPE[engine_type]} engine.\n\nPlease run `{install_command}` to install them before running `sqlmesh init` again."
1300-
)
1301-
1302-
13031289
@cli.group(no_args_is_help=True, hidden=True)
13041290
def dbt() -> None:
13051291
"""Commands for doing dbt-specific things"""

tests/core/test_loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def my_model(context, **kwargs):
207207

208208

209209
def test_load_migrated_dbt_adapter_dispatch_macros(tmp_path: Path):
210-
init_example_project(tmp_path, dialect="duckdb")
210+
init_example_project(tmp_path, engine_type="duckdb")
211211

212212
migrated_package_path = tmp_path / "macros" / c.MIGRATED_DBT_PACKAGES / "dbt_utils"
213213
migrated_package_path.mkdir(parents=True)
@@ -273,7 +273,7 @@ def test_load_migrated_dbt_adapter_dispatch_macros(tmp_path: Path):
273273

274274
def test_load_migrated_dbt_adapter_dispatch_macros_in_different_packages(tmp_path: Path):
275275
# some things like dbt.current_timestamp() dispatch to macros in a different package
276-
init_example_project(tmp_path, dialect="duckdb")
276+
init_example_project(tmp_path, engine_type="duckdb")
277277

278278
migrated_package_path_dbt = tmp_path / "macros" / c.MIGRATED_DBT_PACKAGES / "dbt"
279279
migrated_package_path_dbt_duckdb = tmp_path / "macros" / c.MIGRATED_DBT_PACKAGES / "dbt_duckdb"

0 commit comments

Comments
 (0)