-
Notifications
You must be signed in to change notification settings - Fork 132
feat: add Microsoft Fabric DWH integration (ELE-5282) #962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
2c08c87
4699b73
a0a7285
319dee6
ba6bece
bea97a1
d489172
4a13b4e
a350671
0505cde
dd0dedf
00715f1
ddd219c
f3e8a33
1a8635c
e17d7eb
70dbd4b
72c3f8e
9864781
fbd07fb
3d1aa76
312ccbc
3bba723
b04d35a
241cb0b
b083d2b
0c30c35
ed337d7
1487485
a50077a
9e7778e
342f00f
8821965
ad1f9ac
dd9bbca
12e20a1
acb01a0
fd27dac
a2978b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| version: "3.8" | ||
| services: | ||
| sqlserver: | ||
| image: mcr.microsoft.com/mssql/server:2022-latest | ||
| container_name: sqlserver | ||
| ports: | ||
| - "127.0.0.1:1433:1433" | ||
| environment: | ||
| ACCEPT_EULA: "Y" | ||
| MSSQL_SA_PASSWORD: "${MSSQL_SA_PASSWORD}" | ||
| MSSQL_PID: "Developer" | ||
| healthcheck: | ||
| test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${MSSQL_SA_PASSWORD}" -C -Q "SELECT 1" -b | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 10 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,7 @@ def main( | |
| keep_trailing_newline=True, | ||
| ) | ||
| env.filters["toyaml"] = _yaml_inline | ||
| env.globals["env_var"] = lambda key, default="": os.environ.get(key, default) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, locate and read the generate_profiles.py file around line 126
wc -l integration_tests/profiles/generate_profiles.pyRepository: elementary-data/dbt-data-reliability Length of output: 131 🏁 Script executed: # Read the file with context around line 126
sed -n '110,140p' integration_tests/profiles/generate_profiles.py | cat -nRepository: elementary-data/dbt-data-reliability Length of output: 1193 🏁 Script executed: # Look for usage of env_var in the Jinja templates
find integration_tests -name "*.j2" -o -name "*.yml.j2" | head -20Repository: elementary-data/dbt-data-reliability Length of output: 122 🏁 Script executed: # Check for env_var usage patterns in templates
rg "env_var\(" integration_tests/profiles/ -C 2Repository: elementary-data/dbt-data-reliability Length of output: 438 🏁 Script executed: # Get more context around line 117 in the file
sed -n '100,134p' integration_tests/profiles/generate_profiles.py | cat -nRepository: elementary-data/dbt-data-reliability Length of output: 1611 🌐 Web query:
💡 Result: In dbt,
So “when variable not set, no default” behavior = fail fast with an exception/error. [1][2] Sources: 🏁 Script executed: # Check if there are more usages of env_var in templates or documentation
rg "env_var" integration_tests/ -t yml -t yaml -C 3Repository: elementary-data/dbt-data-reliability Length of output: 107 🏁 Script executed: # Check for all env_var usages in .j2 files more carefully
rg "env_var" integration_tests/profiles/Repository: elementary-data/dbt-data-reliability Length of output: 305 🏁 Script executed: # Check if MSSQL_SA_PASSWORD or similar env vars are expected to be set
grep -r "MSSQL_SA_PASSWORD\|env_var" integration_tests/ --include="*.py" --include="*.md"Repository: elementary-data/dbt-data-reliability Length of output: 209 🏁 Script executed: # See the full context of the function to understand when secrets are vs aren't loaded
sed -n '80,134p' integration_tests/profiles/generate_profiles.py | cat -nRepository: elementary-data/dbt-data-reliability Length of output: 2568 🏁 Script executed: # Check all env_var calls in the entire codebase to see if any have explicit defaults
rg "env_var\(" --type py --type yaml -C 2Repository: elementary-data/dbt-data-reliability Length of output: 379 🏁 Script executed: # Also check .j2 files specifically
fd "\.j2$" integration_tests/ | xargs cat | grep -n "env_var"Repository: elementary-data/dbt-data-reliability Length of output: 135 Preserve required At line 126, missing env vars silently resolve to 🔧 Suggested fix+_MISSING = object()
+
+def _env_var(key: str, default: Any = _MISSING) -> str:
+ value = os.environ.get(key)
+ if value is None:
+ if default is _MISSING:
+ raise click.ClickException(f"Missing required environment variable: {key}")
+ return default
+ return value
+
@@
- env.globals["env_var"] = lambda key, default="": os.environ.get(key, default)
+ env.globals["env_var"] = _env_var🤖 Prompt for AI Agents |
||
| tmpl = env.from_string(template.read_text()) | ||
| rendered = tmpl.render(**context) | ||
| output.write_text(rendered) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,9 +101,12 @@ def test_exclude_specific_timestamps(test_id: str, dbt_project: DbtProject): | |
| ) | ||
| assert test_result["status"] == "pass" | ||
|
|
||
| ts_type = ( | ||
| "datetime2" if dbt_project.target in ("fabric", "sqlserver") else "timestamp" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we have an edr_timestamp or something like that, could we use it? Not sure |
||
| ) | ||
| excluded_buckets_str = ", ".join( | ||
| [ | ||
| "cast('%s' as timestamp)" % cur_ts.strftime(DATE_FORMAT) | ||
| "cast('%s' as %s)" % (cur_ts.strftime(DATE_FORMAT), ts_type) | ||
| for cur_ts in excluded_buckets | ||
| ] | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.