fal-ai / dbt-fal

do more with dbt. dbt-fal helps you run Python alongside dbt, so you can send Slack alerts, detect anomalies and build machine learning models.
https://fal.ai/dbt-fal
Apache License 2.0
853 stars 72 forks source link

Case sensitive naming leads to a "When searching for a relation, dbt found an approximate match" error #858

Closed flunardelli closed 1 year ago

flunardelli commented 1 year ago

Describe the bug Using sql server adapter with a database.schema.table in PascalCase leads a relationship error when I try rerun a dbt-fal python model.

Your environment

20:00:58.046485 [debug] [MainThread]: Command end result 20:00:58.056627 [info ] [MainThread]: 20:00:58.056918 [info ] [MainThread]: Completed with 1 error and 0 warnings: 20:00:58.057071 [info ] [MainThread]: 20:00:58.057227 [error] [MainThread]: Compilation Error in model Int_Base_FalTest (models/intermediate/Base/Int_Base_FalTest.py) 20:00:58.057377 [error] [MainThread]: When searching for a relation, dbt found an approximate match. Instead of guessing 20:00:58.057500 [error] [MainThread]: which relation to use, dbt will move on. Please delete "AdventureWorksDW2019"."EDWStaging"."Int_Base_FalTest", or rename it to be less ambiguous. 20:00:58.057635 [error] [MainThread]: Searched for: "adventureworksdw2019"."edwstaging"."int_base_faltest" 20:00:58.057753 [error] [MainThread]: Found: "AdventureWorksDW2019"."EDWStaging"."Int_Base_FalTest" 20:00:58.057881 [error] [MainThread]:
20:00:58.057996 [error] [MainThread]: > in macro is_incremental (macros/materializations/models/incremental/is_incremental.sql) 20:00:58.058124 [error] [MainThread]: > called by macro py_script_postfix (macros/python_model/python.sql) 20:00:58.058248 [error] [MainThread]: > called by model Int_Base_FalTest (models/intermediate/Base/Int_Base_FalTest.py) 20:00:58.058386 [info ] [MainThread]: 20:00:58.058520 [info ] [MainThread]: Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1 20:00:58.058712 [debug] [MainThread]: Flushing usage events

dbt-fal==1.4.8 dbt-core==1.4.6


- Adapter being used: <!-- (if more than one dbt plugin installed) --> 
dbt-sqlserver==1.4.3
**How to reproduce**
Create an sql server model using PascalCase naming. Run it once and try update it after that.

**Expected behavior**
A model been updated without this relation search error

**Actual behavior**
Compilation Error

**Additional context**
It works on dbt-core, dbt-fal and dbt-sqlserver 1.3.x series. 
chamini2 commented 1 year ago

Hello, @flunardelli, this should be fixed by @mederka 's PR and is now released in https://pypi.org/project/dbt-fal/1.4.9/ . Please let us know if it does not work for you and reopen this issue.