ftmq 4.2.4__tar.gz → 4.2.5__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 ftmq might be problematic. Click here for more details.

Files changed (37) hide show
  1. {ftmq-4.2.4 → ftmq-4.2.5}/PKG-INFO +6 -6
  2. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/__init__.py +1 -1
  3. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/fragments/dataset.py +30 -6
  4. {ftmq-4.2.4 → ftmq-4.2.5}/pyproject.toml +9 -9
  5. {ftmq-4.2.4 → ftmq-4.2.5}/LICENSE +0 -0
  6. {ftmq-4.2.4 → ftmq-4.2.5}/NOTICE +0 -0
  7. {ftmq-4.2.4 → ftmq-4.2.5}/README.md +0 -0
  8. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/aggregate.py +0 -0
  9. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/aggregations.py +0 -0
  10. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/cli.py +0 -0
  11. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/enums.py +0 -0
  12. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/filters.py +0 -0
  13. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/io.py +0 -0
  14. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/logging.py +0 -0
  15. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/model/__init__.py +0 -0
  16. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/model/dataset.py +0 -0
  17. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/model/entity.py +0 -0
  18. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/model/mixins.py +0 -0
  19. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/model/stats.py +0 -0
  20. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/query.py +0 -0
  21. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/similar.py +0 -0
  22. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/sql.py +0 -0
  23. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/__init__.py +0 -0
  24. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/aleph.py +0 -0
  25. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/base.py +0 -0
  26. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/fragments/__init__.py +0 -0
  27. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/fragments/loader.py +0 -0
  28. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/fragments/settings.py +0 -0
  29. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/fragments/store.py +0 -0
  30. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/fragments/utils.py +0 -0
  31. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/lake.py +0 -0
  32. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/level.py +0 -0
  33. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/memory.py +0 -0
  34. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/redis.py +0 -0
  35. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/store/sql.py +0 -0
  36. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/types.py +0 -0
  37. {ftmq-4.2.4 → ftmq-4.2.5}/ftmq/util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ftmq
3
- Version: 4.2.4
3
+ Version: 4.2.5
4
4
  Summary: followthemoney query dsl and io helpers
5
5
  License: AGPLv3+
6
6
  Author: Simon Wörpel
@@ -19,15 +19,15 @@ Provides-Extra: postgres
19
19
  Provides-Extra: redis
20
20
  Provides-Extra: sql
21
21
  Requires-Dist: alephclient (>=2.6.0,<3.0.0) ; extra == "aleph"
22
- Requires-Dist: anystore (>=0.3.11,<0.4.0)
22
+ Requires-Dist: anystore (>=0.4.0,<0.5.0)
23
23
  Requires-Dist: click (>=8.2.1,<9.0.0)
24
24
  Requires-Dist: click-default-group (>=1.2.4,<2.0.0)
25
25
  Requires-Dist: deltalake (>=1.1.4,<2.0.0) ; extra == "lake"
26
- Requires-Dist: duckdb (>=1.3.2,<2.0.0) ; extra == "lake"
26
+ Requires-Dist: duckdb (>=1.4.0,<2.0.0) ; extra == "lake"
27
27
  Requires-Dist: fakeredis (>=2.26.2,<3.0.0) ; extra == "redis"
28
- Requires-Dist: followthemoney (>=4.2.0,<5.0.0)
28
+ Requires-Dist: followthemoney (>=4.2.2,<5.0.0)
29
29
  Requires-Dist: furl (>=2.1.4,<3.0.0) ; extra == "aleph"
30
- Requires-Dist: nomenklatura (>=4.1.2,<5.0.0)
30
+ Requires-Dist: nomenklatura (>=4.1.9,<5.0.0)
31
31
  Requires-Dist: orjson (>=3.10.18,<4.0.0)
32
32
  Requires-Dist: pandas (>=2.3.2,<3.0.0) ; extra == "lake"
33
33
  Requires-Dist: plyvel (>=1.5.1,<2.0.0) ; extra == "level"
@@ -37,7 +37,7 @@ Requires-Dist: pycountry (>=24.6.1,<25.0.0)
37
37
  Requires-Dist: pydantic (>=2.11.3,<3.0.0)
38
38
  Requires-Dist: pyicu (>=2.15.2,<3.0.0)
39
39
  Requires-Dist: redis (>=5.2.1,<6.0.0) ; extra == "redis"
40
- Requires-Dist: rigour (>=1.3.0,<2.0.0)
40
+ Requires-Dist: rigour (>=1.3.10,<2.0.0)
41
41
  Requires-Dist: sqlalchemy (>=2.0.36,<3.0.0) ; extra == "postgres"
42
42
  Requires-Dist: sqlalchemy (>=2.0.36,<3.0.0) ; extra == "sql"
43
43
  Project-URL: Documentation, https://docs.investigraph.dev/lib/ftmq
@@ -2,7 +2,7 @@ from ftmq.io import smart_read_proxies, smart_write_proxies
2
2
  from ftmq.query import Query
3
3
  from ftmq.util import make_entity
4
4
 
5
- __version__ = "4.2.4"
5
+ __version__ = "4.2.5"
6
6
  __all__ = [
7
7
  "smart_read_proxies",
8
8
  "smart_write_proxies",
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ from contextlib import contextmanager
2
3
  from datetime import datetime
3
4
  from typing import Generator, Iterable, TypeAlias
4
5
 
@@ -9,6 +10,7 @@ from normality import slugify
9
10
  from sqlalchemy import (
10
11
  JSON,
11
12
  Column,
13
+ Connection,
12
14
  DateTime,
13
15
  String,
14
16
  Table,
@@ -43,6 +45,27 @@ except ImportError:
43
45
  EntityFragments: TypeAlias = Generator[EntityProxy, None, None]
44
46
 
45
47
 
48
+ @contextmanager
49
+ def disable_timeout(conn: Connection, store):
50
+ # for long running iterations (e.g. re-index in OpenAleph), for postgres we
51
+ # don't want to get cancelled if a idle_in_transaction_timeout is configured
52
+ # on the server
53
+ if store.is_postgres:
54
+ raw_conn = conn.connection.driver_connection
55
+ with raw_conn.cursor() as cursor:
56
+ cursor.execute("SET idle_in_transaction_session_timeout = 0")
57
+ try:
58
+ yield conn
59
+ finally:
60
+ if store.is_postgres:
61
+ try:
62
+ raw_conn = conn.connection.driver_connection
63
+ with raw_conn.cursor() as cursor:
64
+ cursor.execute("SET idle_in_transaction_session_timeout = DEFAULT")
65
+ except Exception:
66
+ pass # Connection might be closed
67
+
68
+
46
69
  class Fragments(object):
47
70
  def __init__(self, store, name, origin=NULL_ORIGIN):
48
71
  self.store = store
@@ -123,12 +146,13 @@ class Fragments(object):
123
146
  # stmt = stmt.order_by(self.table.c.fragment)
124
147
  conn = self.store.engine.connect()
125
148
  try:
126
- conn = conn.execution_options(stream_results=True)
127
- for ent in conn.execute(stmt):
128
- data = {"id": ent.id, "datasets": [self.name], **ent.entity}
129
- if ent.origin != NULL_ORIGIN:
130
- data["origin"] = ent.origin
131
- yield data
149
+ with disable_timeout(conn, self.store) as conn:
150
+ conn = conn.execution_options(stream_results=True)
151
+ for ent in conn.execute(stmt):
152
+ data = {"id": ent.id, "datasets": [self.name], **ent.entity}
153
+ if ent.origin != NULL_ORIGIN:
154
+ data["origin"] = ent.origin
155
+ yield data
132
156
  except Exception:
133
157
  self.reset()
134
158
  raise
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ftmq"
3
- version = "4.2.4"
3
+ version = "4.2.5"
4
4
  description = "followthemoney query dsl and io helpers"
5
5
  authors = [{ name = "Simon Wörpel", email = "simon.woerpel@pm.me" }]
6
6
  license = "AGPLv3+"
@@ -15,10 +15,10 @@ classifiers = [
15
15
  ]
16
16
  requires-python = ">=3.11,<4"
17
17
  dependencies = [
18
- "anystore (>=0.3.11,<0.4.0)",
19
- "followthemoney (>=4.2.0,<5.0.0)",
20
- "nomenklatura (>=4.1.2,<5.0.0)",
21
- "rigour (>=1.3.0,<2.0.0)",
18
+ "anystore (>=0.4.0,<0.5.0)",
19
+ "followthemoney (>=4.2.2,<5.0.0)",
20
+ "nomenklatura (>=4.1.9,<5.0.0)",
21
+ "rigour (>=1.3.10,<2.0.0)",
22
22
  "click (>=8.2.1,<9.0.0)",
23
23
  "click-default-group (>=1.2.4,<2.0.0)",
24
24
  "orjson (>=3.10.18,<4.0.0)",
@@ -33,7 +33,7 @@ sql = ["sqlalchemy (>=2.0.36,<3.0.0)"]
33
33
  postgres = ["sqlalchemy (>=2.0.36,<3.0.0)", "psycopg[pool] (>=3.2.9,<4.0.0)"]
34
34
  redis = ["redis (>=5.2.1,<6.0.0)", "fakeredis (>=2.26.2,<3.0.0)"]
35
35
  lake = [
36
- "duckdb (>=1.3.2,<2.0.0)",
36
+ "duckdb (>=1.4.0,<2.0.0)",
37
37
  "pandas (>=2.3.2,<3.0.0)",
38
38
  "deltalake (>=1.1.4,<2.0.0)",
39
39
  "pyarrow (>=21.0.0,<22.0.0)",
@@ -51,10 +51,10 @@ Issues = "https://github.com/dataresearchcenter/ftmq/issues"
51
51
 
52
52
  [tool.poetry.group.dev.dependencies]
53
53
  pytest = ">=7.4.3,<9.0.0"
54
- pytest-cov = ">=4.1,<7.0"
54
+ pytest-cov = ">=4.1,<8.0"
55
55
  pytest-env = "^1.1.1"
56
56
  black = ">=23.11,<26.0"
57
- isort = "^6.0.1"
57
+ isort = "^6.1.0"
58
58
  mypy = "^1.17.1"
59
59
  pre-commit = "^4.0.1"
60
60
  flake8 = ">=6.1,<8.0"
@@ -62,7 +62,7 @@ ipdb = "^0.13.13"
62
62
  bump2version = "^1.0.1"
63
63
  mkdocs = "^1.6.1"
64
64
  mkdocs-autorefs = "^1.4.3"
65
- mkdocstrings-python = "^1.18.0"
65
+ mkdocstrings-python = "^1.18.2"
66
66
  mkdocs-material = "^9.6.18"
67
67
  mkdocs-click = "^0.9.0"
68
68
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes