dbt-adapter-tests
dbt-adapter-tests copied to clipboard
introspecting hangup during `dbt run` sequence steps
problem
our adapter runs perfectly for jaffle_shop and another user have been able to been using the adapter successfully for an internal data engineering project.
however, we're woefully stuck trying to diagnose why certain dbt-adapter-tests squences are hanging -- specifically at the following places of the tests we've tried to run so far (all variations of dbt run)
details
here's a gist of some of the failure outputs when we run pytest test/integration/shinynewdb.dbtspec -xs --ff
Basically you can see that the first two steps, seed and testing that the seed length is correct. We're also getting helpful logs streamed w/ the addition of pytests -s flag.
The challenge is that upon arrival at step 3, we can no longer introspect. So we need help either getting more info, or, best-case scenario. solving the problem outright!
tried so far
Things we've tried so far to get more information:
using pytest's -s flag
still no output, just Executing step 3/15
peppering{{ log() }} statements everywhere
I added log statements throughout shinynewdb's custom materializations for table and view. basically trying to understand at what point dbt run might be getting stuck... but nothing shows up in the pytest console output?
db's query_history and running_queries tables
looking at the shinynewdb's query_history and running_queries tables show that:
-
the create table statement was run successfully (excerpt below), and
-
there are no currently running queries. why is it hanging then?!?
/* {"app": "dbt", "dbt_version": "0.20.2", "profile_name": "dbt-pytest", "target_name": "default", "node_id": "model.dbt_test_project.table_model"} */ CREATE dimension TABLE IF NOT EXISTS table_model AS ( select * from base) -
table_model also exists and can be easily queried by the database
questions
- how might we find out exactly where
dbt runis hanging? - is the table materialization call completing or not?
- how might the table materialization fail to complete within pytest, but work fine for us w/ jaffle_shop?
- what happens immediately after the table materialization but before
dbt runconcludes? - could it be we're not properly closing our connections?
atten
cc: @jtcohen6

as an update, @drewbanin helpfully shared that adding something like below to the beginning of run_test() in the spec_file.py (around line 749) will at least print out the temporary location of dbt.log which can be used to see logged statements.
print(f'temp log file: {tmpdir}/project/logs/dbt.log')
as a result, we were able to notice an error a relation results test failing with:
80 != 10: turns out the clean up viadrop_schemamacro wasn't working properly, then'10' != 10: turns out there was more type conversion to be done given the JDBC driver we're using
there's still something weird going on where after the dbt run step there's a huge hangtime. I guess we'll investigate further at a later time. here's the most recent dbt.log where it hangs up, though sometimes it finishes without issue...