dbt-labs / dbt-event-logging

a dbt package to make auditing dbt runs easy.

Home Page:https://hub.getdbt.com/dbt-labs/logging/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot execute INSERT in a read-only transaction

moltar opened this issue · comments

commented

Not sure if this is related, but just putting it here, juuust in case it is!

After installing this package, we started getting intermittent failures with:

cannot execute INSERT in a read-only transaction

I cannot for sure say this is because of this package. But we had many runs before installing this package and have never had this error. And in a week after installing had it 3 times.

Database Error



  cannot execute INSERT in a read-only transaction



Traceback (most recent call last):



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/adapters/postgres/connections.py", line 65, in exception_handler



    yield



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/adapters/sql/connections.py", line 70, in add_query



    cursor.execute(sql, bindings)



psycopg2.errors.ReadOnlySqlTransaction: cannot execute INSERT in a read-only transaction











The above exception was the direct cause of the following exception:







Traceback (most recent call last):



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/main.py", line 129, in main



    results, succeeded = handle_and_check(args)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/main.py", line 192, in handle_and_check



    task, res = run_from_args(parsed)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/main.py", line 239, in run_from_args



    results = task.run()



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/task/runnable.py", line 470, in run



    result = self.execute_with_hooks(selected_uids)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/task/runnable.py", line 434, in execute_with_hooks



    self.after_run(adapter, res)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/task/run.py", line 468, in after_run



    self.safe_run_hooks(adapter, RunHookType.End, extras)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/task/run.py", line 389, in safe_run_hooks



    self.run_hooks(adapter, hook_type, extra_context)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/task/run.py", line 355, in run_hooks



    response, _ = adapter.execute(sql, auto_begin=False, fetch=False)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/adapters/base/impl.py", line 242, in execute



    return self.connections.execute(sql=sql, auto_begin=auto_begin, fetch=fetch)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/adapters/sql/connections.py", line 123, in execute



    _, cursor = self.add_query(sql, auto_begin)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/adapters/sql/connections.py", line 78, in add_query



    return connection, cursor



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/contextlib.py", line 131, in __exit__



    self.gen.throw(type, value, traceback)



  File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/dbt/adapters/postgres/connections.py", line 76, in exception_handler



    raise dbt.exceptions.DatabaseException(str(e).strip()) from e



dbt.exceptions.DatabaseException: Database Error



  cannot execute INSERT in a read-only transaction



16:46:55  Running with dbt=1.2.0