I wonder if there might be something wrong in the ...
# community-support
s
I wonder if there might be something wrong in the latest package-version (
v0.11.2
)? (Could also be user error I'm sure). We use the
dbt_models
for many purposes. We have currently 2446 models in the project. In our production environment using
v0.11.1
,
dbt_models
contains all the models. However, in our development and test environments that both use
v0.11.2
, there are only 1203 models present in
dbt_models
. This causes downstream issues for us, and I cannot understand why it is so. Seems like I might have to downgrade.
e
@Sindre Grindheim can you tell me a little bit about your setup? do you have exactly the same code in all the envs? Are you using slim CI?
s
Same code in all environments. All environments write to different catalogs. Not using slim CI. We have disable_dbt_artifacts_autoupload set to true for normal runs, except for deploys - identified by flags.FULL_REFRESH being true. Never had a problem before now though.
e
Can you try to downgrade the other envs to 0.11.1 and see if this solves the issue?
s
Tried downgrading the test environment yesterday, but got a few errors:
14:06:44    Compilation Error in model dbt_models (models/edr/dbt_artifacts/dbt_models.sql)
Delta Lake does not support dropping columns from tables
14:06:44    Compilation Error in model dbt_snapshots (models/edr/dbt_artifacts/dbt_snapshots.sql)
Delta Lake does not support dropping columns from tables
e
did you get this after running
dbt run -s elementary
?
s
We used
dbt run --select state:modified+ --full-refresh
for the deploy. Since the package version was changed, all the elementary models were run as well.
e
@Sindre Grindheim it seems you're not able to downgrade because 0.11.2 added a new column to dbt_models and dbt_snapshots and delta lake cannot delete those columns. removing these columns manually can help you downgrade, but I would like to understand what is causing the missing models. I have a few suspicions as to what may be the issue so writing them here and let me know if you like to try it: 1. If you're running with a state selector I wonder if that means some of the elementary models did not run if they haven't changed, or weren't detected as changed. Would it be possible to try running
dbt run -s elementary
separately just in case and see if that changes anything? 2. if you have artifact upload disabled in some runs and enabled in others I wonder if this can cause the artifacts that are uploaded to somehow be partial. I'm not sure this is the case but to make sure you can run
dbt run --select elementary.edr.dbt_artifacts
. this is the operation that uploads the models to
dbt_models
. If any of those suggestions works this still doesn't mean we understand what happened but it will resolve the issue for you and will help us investigate. If it doesn't, it would be great if you can share your dbt.log with me, along with a name or a few names of models that are missing from your staging schema
s
Tried first running
dbt run --select elementary.edr.dbt_artifacts
and then
dbt run --select elementary.edr.dbt_artifacts --full-refresh
. Both runs gave the same result, where
dbt_models
has 1203 rows. As you can see in the attached screenshot, there are 2450 models. Here are the flags that are set in
dbt_project.yml
- the target name for scheduled runs is <env>_release: • disable_run_results: "{{ 'release' not in target.name }}" • disable_tests_results: "{{ 'release' not in target.name }}" • disable_dbt_artifacts_autoupload: "{{ 'release' not in target.name or not flags.FULL_REFRESH }}" • disable_dbt_invocation_autoupload: "{{ 'release' not in target.name }}"
@Ella Katz By the way, I looked at the generated insert into sql statement for
dbt_models
in the
dbt.log
. After formatting it, the file was 22 684 lines long. Each set of model values was 20 lines, so dividing (22684-23) by 20 then we get 1 133 models. This is exactly the same number I get when running a count query from
dbt_models
. So it looks like the generated insert query is lacking more than half the models, for whatever reason.
@Ella Katz Sorry the spam - but I think I found the culprit:
insert_rows.sql
. I reverted the file to the previous version as of Sep 27, 2023, and then
dbt_models
finally contained all the models.
e
wow thank you! we will look into it
🙏
s
Seems to me that the fix is easy - lines 76-79 should be moved to after line 80. Tested it and it worked like a charm.
e
Hi @Matthias Niehoff, can you confirm if this is the issue for you as well?
m
Will be able to test it tomorrow hopefully. might be related but for me its not model/test metadata but data about test/model runs
Unfortunately that didn’t help. Test Runs still not getting updated for the majority of elementary based tests. ( Just to be sure I did everything correct: 1. installed package 0.11.2, 2. replaced
dbt_packages/elementary/macros/utils/insert_rows.sql
with https://raw.githubusercontent.com/elementary-data/dbt-data-reliability/0.11.1/macros/utils/table_operations/insert_rows.sql 3. dbt run, dbt test, edr-report )
e
Yes @Matthias Niehoff we'll keep investigating your issue. Thanks for trying this out. @Sindre Grindheim we will release the fix soon and update you 🙏🏼
m
Hey @Matthias Niehoff and @Sindre Grindheim, we released
0.12.1
with a fix. Thank you for reporting!
👍 1
m
Hey, thanks for the quick fix. I just tested it and it looks fine so far! 👍
🐕 2
s
Thanks for the fix @Maayan Salom. It did seem to fix the
dbt_models
issue. However, since upgrading to the altest
0.12.1
version, we're struggling with the
on-run-end
hook updating
dbt_columns
. As I've reported in #C02CTC89LAX, it hangs for over an hour and i had to manually cancel it after that (so can't say if it would ever finish). But now I've been forced to once more downgrade to
0.11.1
.
e
Hi @Sindre Grindheim, Checking this out.
Hi @Sindre Grindheim, As of the latest version we started uploading dbt column descriptions as part of the Elementary artifact upload. It's important to note that: 1. the upload should only be slow for the first time, after which it will be cached. 2. you can run it for the first time as a separate command by running
dbt run --select elementary.edr.dbt_artifacts
, after which your regular dbt runs should not get stuck on this anymore 3. I'm working on creating a setting that will disable uploading the columns and we will release it soon but in the meantime you can disable all the artifact upload from your on-run-end hooks and run it manually by following the instructions here.
s
Hi @Ella Katz. The first upload was indeed slow, but it worked fine. The second time however was when the problem occurred. We can't disable all the artifact uploads since we use them actively access control purposes.
e
hmm, that's interesting. Do you have a dbt.log of the run where it got stuck? can you send it to me in DM?