Hi All! I am having a strange issue with an error ...
# announcements
m
Hi All! I am having a strange issue with an error towards the end of each of my pipelines. My postgres db (poorly named ShopifyOrders) is not local. I am getting this error in the logs for the Stripe and FB ads pipelines:
Copy code
Running with dbt=0.14.4
Found 123 models, 15 tests, 0 snapshots, 0 analyses, 128 macros, 0 operations, 0 seed files, 0 sources
ERROR: Cross-db references not allowed in postgres (shopifyorders vs ShopifyOrders)
ELT could not complete, an error happened during the process: dbt run didn't exit cleanly. Exit code: 1
Has anyone seen this before? Also, if this is the wrong place for this please let me know.
d
@matthew_trinkle It looks like this issue was fixed in dbt v0.15.0: https://github.com/fishtown-analytics/dbt/pull/1918 Could you go into your
meltano.yml
, modify the
pip_url
for
dbt
to point at the latest version (
dbt==0.16.1
), run
meltano install
, and then try running your pipeline again?
m
great thanks I will try that
d
@matthew_trinkle If that works, I think we can update the dbt version for everyone at https://gitlab.com/meltano/meltano/blob/master/src/meltano/core/bundle/discovery.yml#L702 🙂
m
okay ill try that and report back
@douwe_maan is there a proper way to shutdown/reset a pipeline either in cmd or the ui? I have one running and I think it had a network problem and is hung up. The UI shows the it in progress, but I suspect it's not actually running anymore.
d
@matthew_trinkle That sounds like https://gitlab.com/meltano/meltano/-/issues/1841, which we unfortunately haven't had a chance to fix yet
The workaround right now would be to either change the pipeline name, or to open up the
.meltano/meltano.db
SQLite DB and manually change the
state
of the latest
job
row
m
okay thanks
@douwe_maan tried running again with dbt=0.16.1, but ran into another issue
Copy code
Running with dbt=0.16.1
Encountered an error while reading the project:
ERROR: Runtime Error
Could not find profile named 'meltano'
Encountered an error:
Runtime Error
Could not run dbt
ELT could not complete, an error happened during the process: dbt clean didn't exit cleanly. Exit code: 2
d
@matthew_trinkle Hmm, I assume the meltano profile still exists in transform/profile/profiles.yml?
m
yes it does
d
That’s odd. Are you running your pipeline through the UI or “meltano elt”? If the latter, could you run it like
meltano --log-level=debug elt ...
so that we can see exactly what arguments dbt is getting called with?
m
I was running through the UI, but I can try running it through the cmd
d
Thanks, that’ll help with debugging
It sounds like “dbt clean” didn’t need to know the profiles path, but does in the latest version(s). meltano is currently only setting it with “dbt run” and “dbt compile”. To verify that’s the issue, could you set the DBT_PROFILES_DIR env var before running “meltano elt” again? Just point it at the “transform/profiles” directory
m
@douwe_maan like this?
Copy code
export DBT_PROFILES_DIR=transform/profiles
d
Yes!
It may need a full absolute path, but let’s see if this works
m
Copy code
root@88f426cfd4ba:/project# meltano --log-level=debug elt tap-facebook target-postgres --transform only
[2020-05-22 18:45:05,386|D|MainThread|root] Activated project at /project
[2020-05-22 18:45:05,387|D|MainThread|root] Creating engine <meltano.core.project.Project object at 0x7fd794c5cb70>@sqlite:////project/.meltano/meltano.db
[2020-05-22 18:45:05,413|I|MainThread|alembic.runtime.migration] Context impl SQLiteImpl.
[2020-05-22 18:45:05,414|I|MainThread|alembic.runtime.migration] Will assume non-transactional DDL.
System database up-to-date.
Starting new HTTPS connection (1): <http://www.meltano.com:443|www.meltano.com:443>
<https://www.meltano.com:443> "GET /discovery.yml HTTP/1.1" 200 31369
Discovery cache updated at /project/.meltano/cache/discovery.yml
Starting new HTTPS connection (1): <http://www.meltano.com:443|www.meltano.com:443>
<https://www.meltano.com:443> "GET /discovery.yml HTTP/1.1" 200 31369
Discovery cache updated at /project/.meltano/cache/discovery.yml
Found ENV variable PG_USERNAME for postgres:user
Found ENV variable PG_PASSWORD for postgres:password
Found ENV variable PG_ADDRESS for postgres:host
Found ENV variable PG_PORT for postgres:port
Found ENV variable PG_DATABASE for postgres:dbname
Extract & load skipped.
Running transformation...
Starting new HTTPS connection (1): <http://www.meltano.com:443|www.meltano.com:443>
<https://www.meltano.com:443> "GET /discovery.yml HTTP/1.1" 200 31369
Discovery cache updated at /project/.meltano/cache/discovery.yml
Found ENV variable PG_USERNAME for postgres:user
Found ENV variable PG_PASSWORD for postgres:password
Found ENV variable PG_ADDRESS for postgres:host
Found ENV variable PG_PORT for postgres:port
Found ENV variable PG_DATABASE for postgres:dbname
Using selector: EpollSelector
Starting new HTTPS connection (1): <http://www.meltano.com:443|www.meltano.com:443>
<https://www.meltano.com:443> "GET /discovery.yml HTTP/1.1" 200 31369
Discovery cache updated at /project/.meltano/cache/discovery.yml
Starting new HTTPS connection (1): <http://www.meltano.com:443|www.meltano.com:443>
<https://www.meltano.com:443> "GET /discovery.yml HTTP/1.1" 200 31369
Discovery cache updated at /project/.meltano/cache/discovery.yml
Running with dbt=0.16.1
Encountered an error while reading the project:
  ERROR: Runtime Error
  Could not find profile named 'meltano'
Encountered an error:
Runtime Error
  Could not run dbt
ELT could not complete, an error happened during the process: dbt clean didn't exit cleanly. Exit code: 2

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/meltano/cli/elt.py", line 79, in elt
    run_transform(elt_context, transform_session, dry_run=dry, models=elt_context.extractor.ref.name)
  File "/usr/local/lib/python3.6/site-packages/meltano/cli/elt.py", line 114, in run_transform
    dbt_runner.run(session, **kwargs)  # TODO: models from elt_context?
  File "/usr/local/lib/python3.6/site-packages/meltano/core/runner/dbt.py", line 54, in run
    loop.run_until_complete(self.dbt_service.clean())
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 488, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.6/site-packages/meltano/core/dbt_service.py", line 85, in clean
    await self.invoke("clean")
  File "/usr/local/lib/python3.6/site-packages/meltano/core/dbt_service.py", line 78, in invoke
    f"dbt {cmd} didn't exit cleanly. Exit code: {handle.returncode}"
Exception: dbt clean didn't exit cleanly. Exit code: 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/meltano/cli/elt.py", line 86, in elt
    raise click.Abort()
didnt seem to work
d
@matthew_trinkle Hmm, all right. Let me try this out locally!
@matthew_trinkle Try this:
DBT_PROFILES_DIR=$(pwd)/transform/profile meltano elt ...
— it looks like
DBT_PROFILES_DIR
needs to be a full absolute path, so we need the
$(pwd)/
bit
m
I think it got further...
Copy code
Running with dbt=0.16.1
Encountered an error:
Compilation Error
  Env var required but not provided: 'DBT_TARGET'
ELT could not complete, an error happened during the process: dbt clean didn't exit cleanly. Exit code: 2
d
All right, that's progress 🙂 Try setting
DBT_TARGET=postgres
Once we've got this working, it'll be pretty easy for me to fix this in Meltano by the way, so you won't need to manually set those variables anymore once Meltano has been updated 🙂
m
okay I think its working...
d
Awesome! Issue created for myself: https://gitlab.com/meltano/meltano/-/issues/2053
m
In the future, would you like this discussion in gitlab or slack?
d
@matthew_trinkle Good question. Since the initial issue you ran into was a bug in (Meltano's supported version of) dbt, rather than Meltano itself, asking it here made more sense than on GitLab. Once we started discussing how to make Meltano compatible with dbt 0.16.1, though, an issue may have been more appropriate. So next time, if you're 100% sure it's an issue in Meltano itself, feel free to go with an issue, but if not (like in this case) Slack is best and we can always move to an issue later 🙂
But thanks for asking! The renewed interest in this project is still so new that I haven't quite figured out our best practices and recommendations around topics like this
m
@douwe_maan Ok sounds good. I work for a small startup and I know how it feels to be pulled in a lot of different directions. I appreciate the quick response. Thanks