ftmq 4.2.3__py3-none-any.whl → 4.2.5__py3-none-any.whl
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.
- ftmq/__init__.py +1 -1
- ftmq/store/fragments/dataset.py +30 -6
- ftmq/store/fragments/store.py +3 -5
- {ftmq-4.2.3.dist-info → ftmq-4.2.5.dist-info}/METADATA +6 -6
- {ftmq-4.2.3.dist-info → ftmq-4.2.5.dist-info}/RECORD +9 -9
- {ftmq-4.2.3.dist-info → ftmq-4.2.5.dist-info}/LICENSE +0 -0
- {ftmq-4.2.3.dist-info → ftmq-4.2.5.dist-info}/NOTICE +0 -0
- {ftmq-4.2.3.dist-info → ftmq-4.2.5.dist-info}/WHEEL +0 -0
- {ftmq-4.2.3.dist-info → ftmq-4.2.5.dist-info}/entry_points.txt +0 -0
ftmq/__init__.py
CHANGED
ftmq/store/fragments/dataset.py
CHANGED
|
@@ -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
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
ftmq/store/fragments/store.py
CHANGED
|
@@ -39,14 +39,12 @@ class Store(object):
|
|
|
39
39
|
self.database_uri = self._adjust_psycopg3_uri(database_uri)
|
|
40
40
|
|
|
41
41
|
# Configure connection pooling for psycopg3
|
|
42
|
+
config.setdefault("pool_size", 1)
|
|
42
43
|
if self.database_uri.startswith("postgresql+psycopg://"):
|
|
43
|
-
config.setdefault("
|
|
44
|
-
config.setdefault("
|
|
45
|
-
config.setdefault("pool_timeout", 30)
|
|
44
|
+
config.setdefault("max_overflow", 5)
|
|
45
|
+
config.setdefault("pool_timeout", 60)
|
|
46
46
|
config.setdefault("pool_recycle", 3600)
|
|
47
47
|
config.setdefault("pool_pre_ping", True)
|
|
48
|
-
else:
|
|
49
|
-
config.setdefault("pool_size", 5)
|
|
50
48
|
|
|
51
49
|
self.engine = create_engine(self.database_uri, future=True, **config)
|
|
52
50
|
self.is_postgres = self.engine.dialect.name == "postgresql"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: ftmq
|
|
3
|
-
Version: 4.2.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ftmq/__init__.py,sha256=
|
|
1
|
+
ftmq/__init__.py,sha256=uJMQgEub6cttDVImesGqkC2HkgxIkYMHTloeCMrl2nQ,245
|
|
2
2
|
ftmq/aggregate.py,sha256=nyAI5w6jKG1T4Jf2yy1ruhPh0vY6p7JWOEYh0SLBdZY,2163
|
|
3
3
|
ftmq/aggregations.py,sha256=YLu1WF3WgcI3tadWKqsoZk3f_3bYUJetIREy2N1u_EM,4794
|
|
4
4
|
ftmq/cli.py,sha256=GScVXHnRlnZ-A22iMR5hCX4H3sHLrqyXnXMtKK-2b04,9837
|
|
@@ -18,10 +18,10 @@ ftmq/store/__init__.py,sha256=HH30KAHqo1kPr4qbjo6oKxdvgpF_XrqPgk8hSCkPbAY,3152
|
|
|
18
18
|
ftmq/store/aleph.py,sha256=vENWpMgV1rViMwcef9wAwOGyrciCnSPRN-dSI103478,3977
|
|
19
19
|
ftmq/store/base.py,sha256=1IgX4haeNUA9NTBCi-hBFVe0u44ra1nGdHAjSTOUEAs,4762
|
|
20
20
|
ftmq/store/fragments/__init__.py,sha256=jHXHejqXe6sBNllAt-BuU24Ou8m5evmsD1UPac5J2GE,750
|
|
21
|
-
ftmq/store/fragments/dataset.py,sha256=
|
|
21
|
+
ftmq/store/fragments/dataset.py,sha256=qVTkAl3erpNunbXb35cjwCB3nYRW8qjfLGuyRICLmLc,9135
|
|
22
22
|
ftmq/store/fragments/loader.py,sha256=iVh8F22IApe9MRY_Z2fOLvT80fCYstFyxu410l4pPQY,4066
|
|
23
23
|
ftmq/store/fragments/settings.py,sha256=4c-BW-blVM9gC_IGPch03eExbZYFZ3V5h9yTfhcHvOI,303
|
|
24
|
-
ftmq/store/fragments/store.py,sha256=
|
|
24
|
+
ftmq/store/fragments/store.py,sha256=LiSfg95LjEmyq2IUpX4CMtp2tE37SEBLtAw0EWufImM,2534
|
|
25
25
|
ftmq/store/fragments/utils.py,sha256=SDoLPFF5O_oJLIPrCEab5iGn-pl6y0AhYZDYIPYxYkk,1098
|
|
26
26
|
ftmq/store/lake.py,sha256=snbEZXTuR9Oy3o7p6XA61IVpsd4-70a6PgoL63PBrRg,11683
|
|
27
27
|
ftmq/store/level.py,sha256=ZGx-mMtJZJNWkpvbe7ajTREnW5MPcnw0ct3nSFLVF0I,781
|
|
@@ -30,9 +30,9 @@ ftmq/store/redis.py,sha256=d0hkGF_BezdIfCMUshXWoQwvGmqT8JFblUMcCxzwkDA,433
|
|
|
30
30
|
ftmq/store/sql.py,sha256=6h3-gDaTAlD-IkiOONcX-JbaAO9-QfSsMjjMPupclcQ,5216
|
|
31
31
|
ftmq/types.py,sha256=HgF8eT3ynKnDUxBYFtoDytS-uN_CS7Yr3DHIX2r4tnk,774
|
|
32
32
|
ftmq/util.py,sha256=CmbZXYAbsKbAjoWn8WxR1Sz4VPXc2gj9CkHwaTqpBG0,15691
|
|
33
|
-
ftmq-4.2.
|
|
34
|
-
ftmq-4.2.
|
|
35
|
-
ftmq-4.2.
|
|
36
|
-
ftmq-4.2.
|
|
37
|
-
ftmq-4.2.
|
|
38
|
-
ftmq-4.2.
|
|
33
|
+
ftmq-4.2.5.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
34
|
+
ftmq-4.2.5.dist-info/METADATA,sha256=oyc17dvkbMkwDZH4qnNeUknc5toSzPvSYgJagx2Pgi4,5281
|
|
35
|
+
ftmq-4.2.5.dist-info/NOTICE,sha256=LNgfzuMbk3kIP_KnyDiXO8rQJmDrLy_PQ7cAY8lCmMM,463
|
|
36
|
+
ftmq-4.2.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
37
|
+
ftmq-4.2.5.dist-info/entry_points.txt,sha256=YGDCjEiPgAMaQ5MqFKH8m-XIybehSXgarDucSlmeK3E,37
|
|
38
|
+
ftmq-4.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|