Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/guides/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ The sources have the following order of precedence:
2. `config.yaml` or `config.py` in the `~/.sqlmesh` folder.
3. `config.yaml` or `config.py` in a project folder. [LOWEST PRECEDENCE]

!!! note
To relocate the `.sqlmesh` folder, set the `SQLMESH_HOME` environment variable to your preferred directory path.

### File type

You can specify a SQLMesh configuration in either YAML or Python.
Expand Down
2 changes: 1 addition & 1 deletion sqlmesh/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

SQLMESH = "sqlmesh"
SQLMESH_MANAGED = "sqlmesh_managed"
SQLMESH_PATH = Path.home() / ".sqlmesh"
SQLMESH_PATH = Path(os.getenv("SQLMESH_HOME") or Path.home() / ".sqlmesh")

PROD = "prod"
"""Prod"""
Expand Down
3 changes: 2 additions & 1 deletion tests/core/engine_adapter/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


from sqlmesh import Config, EngineAdapter
from sqlmesh.core.constants import SQLMESH_PATH
from sqlmesh.core.config.connection import (
ConnectionConfig,
AthenaConnectionConfig,
Expand All @@ -34,7 +35,7 @@ def config(tmp_path: pathlib.Path) -> Config:
project_paths=[
pathlib.Path(os.path.join(os.path.dirname(__file__), "config.yaml")),
],
personal_paths=[pathlib.Path("~/.sqlmesh/config.yaml").expanduser()],
personal_paths=[(SQLMESH_PATH / "config.yaml").expanduser()],
variables={"tmp_path": str(tmp_path)},
)

Expand Down
6 changes: 3 additions & 3 deletions tests/core/engine_adapter/test_trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def test_replace_table_catalog_support(

adapter.replace_query(
table_name=".".join([catalog_name, "schema", "test_table"]),
query_or_df=parse_one("SELECT 1 AS col"),
query_or_df=t.cast(exp.Query, parse_one("SELECT 1 AS col")),
)

sql_calls = to_sql_calls(adapter)
Expand Down Expand Up @@ -705,7 +705,7 @@ def test_insert_overwrite_time_partition_hive(

adapter.insert_overwrite_by_time_partition(
table_name=".".join(["my_catalog", "schema", "test_table"]),
query_or_df=parse_one("SELECT a, b FROM tbl"),
query_or_df=t.cast(exp.Query, parse_one("SELECT a, b FROM tbl")),
start="2022-01-01",
end="2022-01-02",
time_column="b",
Expand Down Expand Up @@ -743,7 +743,7 @@ def test_insert_overwrite_time_partition_iceberg(

adapter.insert_overwrite_by_time_partition(
table_name=".".join(["my_catalog", "schema", "test_table"]),
query_or_df=parse_one("SELECT a, b FROM tbl"),
query_or_df=t.cast(exp.Query, parse_one("SELECT a, b FROM tbl")),
start="2022-01-01",
end="2022-01-02",
time_column="b",
Expand Down
2 changes: 1 addition & 1 deletion tests/dbt/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_adapter_relation(sushi_test_project: Project, runtime_renderer: t.Calla
table_name="foo.another", target_columns_to_types={"col": exp.DataType.build("int")}
)
engine_adapter.create_view(
view_name="foo.bar_view", query_or_df=parse_one("select * from foo.bar")
view_name="foo.bar_view", query_or_df=t.cast(exp.Query, parse_one("select * from foo.bar"))
)
engine_adapter.create_table(
table_name="ignored.ignore", target_columns_to_types={"col": exp.DataType.build("int")}
Expand Down