dagster-postgres 0.23.10__tar.gz → 0.23.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dagster-postgres might be problematic. Click here for more details.

Files changed (25) hide show
  1. {dagster-postgres-0.23.10/dagster_postgres.egg-info → dagster-postgres-0.23.12}/PKG-INFO +1 -1
  2. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/event_log/event_log.py +13 -11
  3. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/run_storage/run_storage.py +14 -12
  4. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/schedule_storage/schedule_storage.py +13 -11
  5. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/utils.py +4 -2
  6. dagster-postgres-0.23.12/dagster_postgres/version.py +1 -0
  7. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12/dagster_postgres.egg-info}/PKG-INFO +1 -1
  8. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres.egg-info/requires.txt +1 -1
  9. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/setup.py +1 -1
  10. dagster-postgres-0.23.10/dagster_postgres/version.py +0 -1
  11. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/LICENSE +0 -0
  12. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/MANIFEST.in +0 -0
  13. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/README.md +0 -0
  14. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/__init__.py +0 -0
  15. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/alembic/alembic.ini +0 -0
  16. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/event_log/__init__.py +0 -0
  17. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/py.typed +0 -0
  18. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/run_storage/__init__.py +0 -0
  19. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/schedule_storage/__init__.py +0 -0
  20. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres/storage.py +0 -0
  21. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres.egg-info/SOURCES.txt +0 -0
  22. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres.egg-info/dependency_links.txt +0 -0
  23. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres.egg-info/not-zip-safe +0 -0
  24. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/dagster_postgres.egg-info/top_level.txt +0 -0
  25. {dagster-postgres-0.23.10 → dagster-postgres-0.23.12}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dagster-postgres
3
- Version: 0.23.10
3
+ Version: 0.23.12
4
4
  Summary: A Dagster integration for postgres
5
5
  Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-postgres
6
6
  Author: Dagster Labs
@@ -30,15 +30,16 @@ from dagster._core.storage.sql import (
30
30
  )
31
31
  from dagster._core.storage.sqlalchemy_compat import db_select
32
32
  from dagster._serdes import ConfigurableClass, ConfigurableClassData, deserialize_value
33
+ from sqlalchemy import event
33
34
  from sqlalchemy.engine import Connection
34
35
 
35
36
  from ..utils import (
36
37
  create_pg_connection,
37
38
  pg_alembic_config,
38
- pg_statement_timeout,
39
39
  pg_url_from_config,
40
40
  retry_pg_connection_fn,
41
41
  retry_pg_creation_fn,
42
+ set_pg_statement_timeout,
42
43
  )
43
44
 
44
45
  CHANNEL_NAME = "run_events"
@@ -112,18 +113,19 @@ class PostgresEventLogStorage(SqlEventLogStorage, ConfigurableClass):
112
113
 
113
114
  def optimize_for_webserver(self, statement_timeout: int, pool_recycle: int) -> None:
114
115
  # When running in dagster-webserver, hold an open connection and set statement_timeout
116
+ kwargs = {
117
+ "isolation_level": "AUTOCOMMIT",
118
+ "pool_size": 1,
119
+ "pool_recycle": pool_recycle,
120
+ }
115
121
  existing_options = self._engine.url.query.get("options")
116
- timeout_option = pg_statement_timeout(statement_timeout)
117
122
  if existing_options:
118
- options = f"{timeout_option} {existing_options}"
119
- else:
120
- options = timeout_option
121
- self._engine = create_engine(
122
- self.postgres_url,
123
- isolation_level="AUTOCOMMIT",
124
- pool_size=1,
125
- connect_args={"options": options},
126
- pool_recycle=pool_recycle,
123
+ kwargs["connect_args"] = {"options": existing_options}
124
+ self._engine = create_engine(self.postgres_url, **kwargs)
125
+ event.listen(
126
+ self._engine,
127
+ "connect",
128
+ lambda connection, _: set_pg_statement_timeout(connection, statement_timeout),
127
129
  )
128
130
 
129
131
  def upgrade(self) -> None:
@@ -25,15 +25,16 @@ from dagster._core.storage.sql import (
25
25
  from dagster._daemon.types import DaemonHeartbeat
26
26
  from dagster._serdes import ConfigurableClass, ConfigurableClassData, serialize_value
27
27
  from dagster._utils import utc_datetime_from_timestamp
28
+ from sqlalchemy import event
28
29
  from sqlalchemy.engine import Connection
29
30
 
30
31
  from ..utils import (
31
32
  create_pg_connection,
32
33
  pg_alembic_config,
33
- pg_statement_timeout,
34
34
  pg_url_from_config,
35
35
  retry_pg_connection_fn,
36
36
  retry_pg_creation_fn,
37
+ set_pg_statement_timeout,
37
38
  )
38
39
 
39
40
 
@@ -107,19 +108,20 @@ class PostgresRunStorage(SqlRunStorage, ConfigurableClass):
107
108
  stamp_alembic_rev(pg_alembic_config(__file__), conn)
108
109
 
109
110
  def optimize_for_webserver(self, statement_timeout: int, pool_recycle: int) -> None:
110
- # When running in dagster-webserver, hold 1 open connection and set statement_timeout
111
+ # When running in dagster-webserver, hold an open connection and set statement_timeout
112
+ kwargs = {
113
+ "isolation_level": "AUTOCOMMIT",
114
+ "pool_size": 1,
115
+ "pool_recycle": pool_recycle,
116
+ }
111
117
  existing_options = self._engine.url.query.get("options")
112
- timeout_option = pg_statement_timeout(statement_timeout)
113
118
  if existing_options:
114
- options = f"{timeout_option} {existing_options}"
115
- else:
116
- options = timeout_option
117
- self._engine = create_engine(
118
- self.postgres_url,
119
- isolation_level="AUTOCOMMIT",
120
- pool_size=1,
121
- connect_args={"options": options},
122
- pool_recycle=pool_recycle,
119
+ kwargs["connect_args"] = {"options": existing_options}
120
+ self._engine = create_engine(self.postgres_url, **kwargs)
121
+ event.listen(
122
+ self._engine,
123
+ "connect",
124
+ lambda connection, _: set_pg_statement_timeout(connection, statement_timeout),
123
125
  )
124
126
 
125
127
  @property
@@ -24,15 +24,16 @@ from dagster._core.storage.sql import (
24
24
  stamp_alembic_rev,
25
25
  )
26
26
  from dagster._serdes import ConfigurableClass, ConfigurableClassData, serialize_value
27
+ from sqlalchemy import event
27
28
  from sqlalchemy.engine import Connection
28
29
 
29
30
  from ..utils import (
30
31
  create_pg_connection,
31
32
  pg_alembic_config,
32
- pg_statement_timeout,
33
33
  pg_url_from_config,
34
34
  retry_pg_connection_fn,
35
35
  retry_pg_creation_fn,
36
+ set_pg_statement_timeout,
36
37
  )
37
38
 
38
39
 
@@ -103,18 +104,19 @@ class PostgresScheduleStorage(SqlScheduleStorage, ConfigurableClass):
103
104
 
104
105
  def optimize_for_webserver(self, statement_timeout: int, pool_recycle: int) -> None:
105
106
  # When running in dagster-webserver, hold an open connection and set statement_timeout
107
+ kwargs = {
108
+ "isolation_level": "AUTOCOMMIT",
109
+ "pool_size": 1,
110
+ "pool_recycle": pool_recycle,
111
+ }
106
112
  existing_options = self._engine.url.query.get("options")
107
- timeout_option = pg_statement_timeout(statement_timeout)
108
113
  if existing_options:
109
- options = f"{timeout_option} {existing_options}"
110
- else:
111
- options = timeout_option
112
- self._engine = create_engine(
113
- self.postgres_url,
114
- isolation_level="AUTOCOMMIT",
115
- pool_size=1,
116
- connect_args={"options": options},
117
- pool_recycle=pool_recycle,
114
+ kwargs["connect_args"] = {"options": existing_options}
115
+ self._engine = create_engine(self.postgres_url, **kwargs)
116
+ event.listen(
117
+ self._engine,
118
+ "connect",
119
+ lambda connection, _: set_pg_statement_timeout(connection, statement_timeout),
118
120
  )
119
121
 
120
122
  @property
@@ -169,6 +169,8 @@ def create_pg_connection(
169
169
  conn.close()
170
170
 
171
171
 
172
- def pg_statement_timeout(millis: int) -> str:
172
+ def set_pg_statement_timeout(conn: psycopg2.extensions.connection, millis: int):
173
173
  check.int_param(millis, "millis")
174
- return f"-c statement_timeout={millis}"
174
+ with conn:
175
+ with conn.cursor() as curs:
176
+ curs.execute(f"SET statement_timeout = {millis};")
@@ -0,0 +1 @@
1
+ __version__ = "0.23.12"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dagster-postgres
3
- Version: 0.23.10
3
+ Version: 0.23.12
4
4
  Summary: A Dagster integration for postgres
5
5
  Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-postgres
6
6
  Author: Dagster Labs
@@ -1,2 +1,2 @@
1
- dagster==1.7.10
1
+ dagster==1.7.12
2
2
  psycopg2-binary
@@ -40,6 +40,6 @@ setup(
40
40
  },
41
41
  include_package_data=True,
42
42
  python_requires=">=3.8,<3.13",
43
- install_requires=["dagster==1.7.10", "psycopg2-binary"],
43
+ install_requires=["dagster==1.7.12", "psycopg2-binary"],
44
44
  zip_safe=False,
45
45
  )
@@ -1 +0,0 @@
1
- __version__ = "0.23.10"