Возникла проблема: при использовании Astronomer.io(Docker, Airflow) во время любой операции возникает ошибка(трейс прикладываю). При это создание engine и сессии успешно, в файле postgresql.conf прослушка стоит '*' в чем может быть проблема?
Traceback
(venv) astro@2ddcad34fad1:/usr/local/airflow/workflow$ python3 -i src/main.py
2023-10-22 20:50:47.467 | INFO | src.databases.DatabaseWorker:__init__:67 - Connecting to XXXX database
2023-10-22 20:50:47.479 | SUCCESS | src.databases.DatabaseWorker:__init__:73 - Connect succesfully
>>> update_ozon_items()
2023-10-22 20:51:05.776 | INFO | src.databases.DatabaseWorker:session:98 - Create a session
2023-10-22 20:51:05.777 | INFO | src.api.base_api:request:46 - Getting data from /v2/product/list
2023-10-22 20:51:05.948 | SUCCESS | src.api.base_api:request:79 - Request is succesful
2023-10-22 20:51:05.950 | INFO | src.api.ozon:get_items:80 - Get items list. Total items: 222
2023-10-22 20:51:05.954 | INFO | src.api.ozon:get_items_info:111 - Items list is not given. All items set by default
2023-10-22 20:51:05.954 | INFO | src.api.base_api:request:46 - Getting data from /v2/product/info/list
2023-10-22 20:51:06.299 | SUCCESS | src.api.base_api:request:79 - Request is succesful
2023-10-22 20:51:06.308 | INFO | src.api.ozon:get_items_info:117 - Get items info list
2023-10-22 20:51:06.369 | INFO | src.transform.table_convertion:_ozon_items:109 - Complete transforming dataframe
2023-10-22 20:51:06.387 | ERROR | src.databases.core:upsert_table:94 - Error while inserting. Traceback: (psycopg2.OperationalError) connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
Is the server running on that host and accepting TCP/IP connections?
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Traceback (most recent call last):
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 145, in __init__
self._dbapi_connection = engine.raw_connection()
│ │ └ <function Engine.raw_connection at 0x7f0d74fbcfe0>
│ └ Engine(postgresql+psycopg2://XXXX:***@localhost:5432/XXXX)
└ <sqlalchemy.engine.base.Connection object at 0x7f0d5b707390>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3292, in raw_connection
return self.pool.connect()
│ │ └ <function Pool.connect at 0x7f0d757840e0>
│ └ <sqlalchemy.pool.impl.QueuePool object at 0x7f0d5cf53550>
└ Engine(postgresql+psycopg2://XXXX:***@localhost:5432/XXXX)
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 452, in connect
return _ConnectionFairy._checkout(self)
│ │ └ <sqlalchemy.pool.impl.QueuePool object at 0x7f0d5cf53550>
│ └ <classmethod(<function _ConnectionFairy._checkout at 0x7f0d75786160>)>
└ <class 'sqlalchemy.pool.base._ConnectionFairy'>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 1269, in _checkout
fairy = _ConnectionRecord.checkout(pool)
│ │ └ <sqlalchemy.pool.impl.QueuePool object at 0x7f0d5cf53550>
│ └ <classmethod(<function _ConnectionRecord.checkout at 0x7f0d75784cc0>)>
└ <class 'sqlalchemy.pool.base._ConnectionRecord'>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 716, in checkout
rec = pool._do_get()
│ └ <function QueuePool._do_get at 0x7f0d753958a0>
└ <sqlalchemy.pool.impl.QueuePool object at 0x7f0d5cf53550>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 169, in _do_get
with util.safe_reraise():
│ └ <class 'sqlalchemy.util.langhelpers.safe_reraise'>
└ <module 'sqlalchemy.util' from '/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/util/__init__.py'>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
raise exc_value.with_traceback(exc_tb)
│ │ └ <traceback object at 0x7f0d5b63f100>
│ └ <method 'with_traceback' of 'BaseException' objects>
└ OperationalError('connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused\n\tIs the server runn...
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 167, in _do_get
return self._create_connection()
│ └ <function Pool._create_connection at 0x7f0d7576be20>
└ <sqlalchemy.pool.impl.QueuePool object at 0x7f0d5cf53550>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 393, in _create_connection
return _ConnectionRecord(self)
│ └ <sqlalchemy.pool.impl.QueuePool object at 0x7f0d5cf53550>
└ <class 'sqlalchemy.pool.base._ConnectionRecord'>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 678, in __init__
self.__connect()
└ <sqlalchemy.pool.base._ConnectionRecord object at 0x7f0d5b5a94e0>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 902, in __connect
with util.safe_reraise():
│ └ <class 'sqlalchemy.util.langhelpers.safe_reraise'>
└ <module 'sqlalchemy.util' from '/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/util/__init__.py'>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
raise exc_value.with_traceback(exc_tb)
│ │ └ <traceback object at 0x7f0d5b63f440>
│ └ <method 'with_traceback' of 'BaseException' objects>
└ OperationalError('connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused\n\tIs the server runn...
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 898, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
│ │ │ │ └ <sqlalchemy.pool.base._ConnectionRecord object at 0x7f0d5b5a94e0>
│ │ │ └ <function create_engine.<locals>.connect at 0x7f0d5cec49a0>
│ │ └ <sqlalchemy.pool.impl.QueuePool object at 0x7f0d5cf53550>
│ └ <member 'dbapi_connection' of '_ConnectionRecord' objects>
└ <sqlalchemy.pool.base._ConnectionRecord object at 0x7f0d5b5a94e0>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/engine/create.py", line 637, in connect
return dialect.connect(*cargs, **cparams)
│ │ │ └ {'host': 'localhost', 'dbname': 'XXXX', 'user': 'XXXX, 'password': 'XXXX', 'port': 5432}
│ │ └ []
│ └ <function DefaultDialect.connect at 0x7f0d74e88c20>
└ <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f0d5d1a2810>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 616, in connect
return self.loaded_dbapi.connect(*cargs, **cparams)
│ │ │ │ └ {'host': 'localhost', 'dbname': 'XXXX', 'user': 'XXXX, 'password': 'XXXX', 'port': 5432}
│ │ │ └ ()
│ │ └ <function connect at 0x7f0d5cf48720>
│ └ <module 'psycopg2' from '/usr/local/airflow/venv/lib/python3.11/site-packages/psycopg2/__init__.py'>
└ <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f0d5d1a2810>
File "/usr/local/airflow/venv/lib/python3.11/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
│ │ │ └ {}
│ │ └ None
│ └ 'host=localhost dbname=XXXX user=XXXX password=XXXX port=5432'
└ <built-in function _connect>
psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
Is the server running on that host and accepting TCP/IP connections?