I am trying to use a second dbt-postgres to transf...
# troubleshooting
s
I am trying to use a second dbt-postgres to transform the data to a different database, but I got the following error:
Copy code
024-05-09T22:24:59.363374Z [info     ] Environment 'local' is active
Extension executing `dbt clean`...
Traceback (most recent call last):
  File "/Users/seanhan/Workspaces/data_platform/meltano/.meltano/utilities/dbt-postgres/venv/lib/python3.9/site-packages/meltano/edk/extension.py", line 122, in pass_through_invoker
    self.pre_invoke(None, *command_args)
  File "/Users/seanhan/Workspaces/data_platform/meltano/.meltano/utilities/dbt-postgres/venv/lib/python3.9/site-packages/dbt_ext/extension.py", line 71, in pre_invoke
    self.dbt_invoker.run_and_log("clean")
  File "/Users/seanhan/Workspaces/data_platform/meltano/.meltano/utilities/dbt-postgres/venv/lib/python3.9/site-packages/meltano/edk/process.py", line 172, in run_and_log
    result = asyncio.run(self._exec(sub_command, *args))
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/seanhan/Workspaces/data_platform/meltano/.meltano/utilities/dbt-postgres/venv/lib/python3.9/site-packages/meltano/edk/process.py", line 126, in _exec
    p = await asyncio.create_subprocess_exec(
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/asyncio/subprocess.py", line 236, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/asyncio/base_events.py", line 1676, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/asyncio/unix_events.py", line 197, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/asyncio/unix_events.py", line 789, in _start
    self._proc = subprocess.Popen(
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/seanhan/.asdf/installs/python/3.9.15/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'dbt'
pre_invoke failed with uncaught exception, please report to maintainer
Here is my mletano.yml:
Copy code
utilities:
  - name: dbt-postgres
    variant: dbt-labs
    pip_url: dbt-core~=1.3.0 dbt-postgres~=1.3.0 git+<https://github.com/meltano/dbt-ext.git@main>
    config:
      host: ${APP_DB_HOST}
      user: ${APP_DB_USER_NAME}
      port: 5432
      dbname: ${APP_DB_NAME}
      schema: public
  - name: dbt-postgres-second
    inherit_from: dbt-postgres
    config:
      host: $SECOND_DB_HOST}
      user: ${SECOND_DB_USER_NAME}
      port: 5432
      dbname: ${SECOND_DB_NAME}
      schema: analytics
The first one is working fine, but the second one fails. does anyone know how to fix the issue?
e
can you run
meltano install --clean
and try again?
s
same problem
e
Ok so what's the command you ran and failed?
s
meltano invoke dbt-postgres-second run --select +my_second_model
The first model is working fine: meltano invoke dbt-postgres run --select +my_first_model
does anyone know this is the right way to use dbt with multiple databases in the same Meltano project?