tol-sdk 1.8.9__py3-none-any.whl → 1.8.10__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.
- tol/core/datasource_utils.py +8 -5
- tol/sources/portaldb.py +4 -2
- tol/sources/sql.py +25 -0
- tol/sql/sql_datasource.py +1 -0
- tol/validators/taxon_matches_goat.py +1 -1
- {tol_sdk-1.8.9.dist-info → tol_sdk-1.8.10.dist-info}/METADATA +1 -1
- {tol_sdk-1.8.9.dist-info → tol_sdk-1.8.10.dist-info}/RECORD +11 -10
- {tol_sdk-1.8.9.dist-info → tol_sdk-1.8.10.dist-info}/WHEEL +0 -0
- {tol_sdk-1.8.9.dist-info → tol_sdk-1.8.10.dist-info}/entry_points.txt +0 -0
- {tol_sdk-1.8.9.dist-info → tol_sdk-1.8.10.dist-info}/licenses/LICENSE +0 -0
- {tol_sdk-1.8.9.dist-info → tol_sdk-1.8.10.dist-info}/top_level.txt +0 -0
tol/core/datasource_utils.py
CHANGED
|
@@ -30,10 +30,13 @@ class DataSourceUtils:
|
|
|
30
30
|
@classmethod
|
|
31
31
|
def get_datasource_by_datasource_instance(
|
|
32
32
|
cls,
|
|
33
|
-
datasource_instance: DataObject
|
|
33
|
+
datasource_instance: DataObject,
|
|
34
|
+
**kwargs
|
|
34
35
|
) -> DataSource:
|
|
35
36
|
datasource_config = datasource_instance.data_source_config
|
|
36
|
-
|
|
37
|
+
new_kwargs = dict(datasource_instance.kwargs) if datasource_instance.kwargs else {}
|
|
38
|
+
if kwargs:
|
|
39
|
+
new_kwargs.update(kwargs)
|
|
37
40
|
if datasource_config:
|
|
38
41
|
relationship_config = cls.get_relationship_config_from_data_source_config(
|
|
39
42
|
datasource_config
|
|
@@ -44,14 +47,14 @@ class DataSourceUtils:
|
|
|
44
47
|
runtime_fields = cls.get_runtime_fields_from_data_source_config(
|
|
45
48
|
datasource_config
|
|
46
49
|
)
|
|
47
|
-
|
|
50
|
+
new_kwargs.update({
|
|
48
51
|
'relationship_cfg': relationship_config,
|
|
49
52
|
'attribute_metadata': amd,
|
|
50
53
|
'runtime_fields': runtime_fields
|
|
51
54
|
})
|
|
52
55
|
return DataSourceUtils.get_datasource_by_name(
|
|
53
56
|
datasource_instance.builtin_name,
|
|
54
|
-
**
|
|
57
|
+
**new_kwargs
|
|
55
58
|
)
|
|
56
59
|
|
|
57
60
|
@classmethod
|
|
@@ -83,7 +86,6 @@ class DataSourceUtils:
|
|
|
83
86
|
cls,
|
|
84
87
|
datasource_config: DataObject
|
|
85
88
|
) -> dict:
|
|
86
|
-
from ..elastic.runtime_fields import RuntimeFields # Break circular import cycle
|
|
87
89
|
runtime_fields = {}
|
|
88
90
|
f = DataSourceFilter()
|
|
89
91
|
f.and_ = {
|
|
@@ -95,6 +97,7 @@ class DataSourceUtils:
|
|
|
95
97
|
if dsa.object_type not in runtime_fields:
|
|
96
98
|
runtime_fields[dsa.object_type] = {}
|
|
97
99
|
if 'function' in dsa.runtime_definition:
|
|
100
|
+
from ..elastic.runtime_fields import RuntimeFields # Break circular import cycle
|
|
98
101
|
method = getattr(RuntimeFields, dsa.runtime_definition['function'])
|
|
99
102
|
runtime_fields[dsa.object_type][dsa.name] = \
|
|
100
103
|
method(**dsa.runtime_definition.get('function_kwargs', {}))
|
tol/sources/portaldb.py
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
6
|
|
|
7
|
+
from .defaults import Defaults
|
|
7
8
|
from ..api_client import (
|
|
8
9
|
ApiDataSource,
|
|
9
10
|
create_api_datasource
|
|
@@ -15,9 +16,10 @@ from ..core import (
|
|
|
15
16
|
|
|
16
17
|
def portaldb(retries: int = 5, **kwargs) -> ApiDataSource:
|
|
17
18
|
portaldb = create_api_datasource(
|
|
18
|
-
api_url=os.getenv('PORTAL_URL'
|
|
19
|
+
api_url=os.getenv('PORTAL_URL', Defaults.PORTAL_URL)
|
|
20
|
+
+ os.getenv('PORTAL_API_PATH', Defaults.PORTAL_API_PATH),
|
|
19
21
|
token=os.getenv('PORTAL_API_KEY'),
|
|
20
|
-
data_prefix='',
|
|
22
|
+
data_prefix='/local',
|
|
21
23
|
retries=retries
|
|
22
24
|
)
|
|
23
25
|
core_data_object(portaldb)
|
tol/sources/sql.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2023 Genome Research Ltd.
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
from ..core import (
|
|
6
|
+
core_data_object
|
|
7
|
+
)
|
|
8
|
+
from ..sql import (
|
|
9
|
+
SqlDataSource,
|
|
10
|
+
create_sql_datasource
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Create a SQL datasource. This is also expecting the models to be passed in
|
|
15
|
+
# so would most likely be used within an app
|
|
16
|
+
def sql(models, db_uri, behind_api, database_factory, **kwargs) -> SqlDataSource:
|
|
17
|
+
sql_ds = create_sql_datasource(
|
|
18
|
+
models=models,
|
|
19
|
+
db_uri=db_uri,
|
|
20
|
+
behind_api=True,
|
|
21
|
+
database_factory=database_factory,
|
|
22
|
+
**kwargs
|
|
23
|
+
)
|
|
24
|
+
core_data_object(sql_ds)
|
|
25
|
+
return sql_ds
|
tol/sql/sql_datasource.py
CHANGED
|
@@ -86,6 +86,7 @@ class SqlDataSource(
|
|
|
86
86
|
sorter_factory: SorterFactory,
|
|
87
87
|
user_id_getter: Optional[UserIdGetter] = None,
|
|
88
88
|
attribute_metadata: AttributeMetadata = DefaultAttributeMetadata,
|
|
89
|
+
**kwargs
|
|
89
90
|
) -> None:
|
|
90
91
|
self.__db = db
|
|
91
92
|
self.__type_tablename_map = type_tablename_map
|
|
@@ -29,7 +29,7 @@ class TaxonMatchesGoatValidator(Validator):
|
|
|
29
29
|
__goat_datasource: GoatDataSource
|
|
30
30
|
_cached_taxa: dict[str, DataObject]
|
|
31
31
|
|
|
32
|
-
def __init__(self, config: Config) -> None:
|
|
32
|
+
def __init__(self, config: Config, **kwargs) -> None:
|
|
33
33
|
super().__init__()
|
|
34
34
|
self.__config = config
|
|
35
35
|
self.__goat_datasource = goat()
|
|
@@ -96,7 +96,7 @@ tol/core/data_source_dict.py,sha256=d-hSmoWTwG6IOc0cQTLap1EBslsxYIWGUd3ScSoeH_Q,
|
|
|
96
96
|
tol/core/datasource.py,sha256=e9GaeDPfO_Gs7cgQhmNxCiSDlRNf64reegzFebcMNkA,6303
|
|
97
97
|
tol/core/datasource_error.py,sha256=TqfqaPANG0gishadhA7myCmTO1Fg9u7hVZOvsY6BdAo,1660
|
|
98
98
|
tol/core/datasource_filter.py,sha256=RY2S9kTx0XwdrFRSE2n2GohB9__fKGzFVsZrkN5hzQk,726
|
|
99
|
-
tol/core/datasource_utils.py,sha256=
|
|
99
|
+
tol/core/datasource_utils.py,sha256=6J72RS49IO2quCaFUXBl4DnjZBlXx-aW3Zy9iuzyeQ8,6327
|
|
100
100
|
tol/core/factory.py,sha256=qbLvp5mLTcHbxOjopqtnK-wbZrlskgXjRIREszZjSyE,9157
|
|
101
101
|
tol/core/http_client.py,sha256=QyZarplEHVYIrqEfrySeHbawfbnBU4nN62TLt41x4tY,2242
|
|
102
102
|
tol/core/relationship.py,sha256=etdyCjLbfi2tgkaqzE6cntpNtTzgT_jOPGeNKmPu5yc,4624
|
|
@@ -290,9 +290,10 @@ tol/sources/labwhere.py,sha256=gbfpPNKEZEfvw9DXGshg1w4Kdo_tpjWoxndDza6Oa6E,541
|
|
|
290
290
|
tol/sources/mlwh.py,sha256=wPs2yuU1A8v57jaDQbeIThraDqVtzzhm5DAa0qekApM,324
|
|
291
291
|
tol/sources/portal.py,sha256=1mhX1c4fjbRoHJ86RuBgyXFbDJrVIV55pGwvnuOxVuA,761
|
|
292
292
|
tol/sources/portal_attributes.py,sha256=j_ZIZ8RHpgbRzOdHSOnzhAM9xA0HcwiAxuVgybVtDrg,1926
|
|
293
|
-
tol/sources/portaldb.py,sha256=
|
|
293
|
+
tol/sources/portaldb.py,sha256=fZNIUk5mZ3RuQiknZQlPxOK6Vdz_pzqz1-w_dW0L2yE,626
|
|
294
294
|
tol/sources/prefect.py,sha256=16PrC_KfvxrsDzAcq7UvEBo4c6_n38NC23vHQeiljck,1046
|
|
295
295
|
tol/sources/sciops.py,sha256=qbdoNEo-BfWGw16sjANV7dxFRVMDJQlvaSZgofE8604,1129
|
|
296
|
+
tol/sources/sql.py,sha256=mP5hyNNoxi8yKY1Z-6G5EZ1VW24BW_3q5Hp-w5VpPmE,623
|
|
296
297
|
tol/sources/sts.py,sha256=vd65QAYIM1lltHajqJPOrGg10ZCI7OUB2dbWNAlrAn8,749
|
|
297
298
|
tol/sources/sts_legacy.py,sha256=jWDM1_Jicxhay9UEOGh4lzeO0TIxuH8sa34TCn-GDWQ,440
|
|
298
299
|
tol/sources/tolid.py,sha256=ERSB5L_u7c4NtGYTzdGXWjiGiL58QJNC_0ij1MQMMEQ,663
|
|
@@ -314,7 +315,7 @@ tol/sql/relationship.py,sha256=EClMgVx_If5nZV9MV99TQk7Wr7uACWetwQdWAliM5XI,2891
|
|
|
314
315
|
tol/sql/session.py,sha256=VmqTegr4L2X2zvaOJCpwSrkVRx8fc1RVL0drkL2MXu8,806
|
|
315
316
|
tol/sql/sort.py,sha256=ENrjHGgj4fZtXKmkdlkv1HRi1X14SVlcl-tp8Pu7G0k,2553
|
|
316
317
|
tol/sql/sql_converter.py,sha256=taD5FRwadvw2bBaUGrCIiUs0-ATAbBnRYI1M7xe3yEc,4618
|
|
317
|
-
tol/sql/sql_datasource.py,sha256=
|
|
318
|
+
tol/sql/sql_datasource.py,sha256=2FUwGTIN5Dw2cNAEb9fWGsZ0PVdjhdjn8WajA_9LT_Y,15615
|
|
318
319
|
tol/sql/action/__init__.py,sha256=T1zAsCza_lvsNtXF1ecSLt9OFGup8tGnIs68YylBmXI,142
|
|
319
320
|
tol/sql/action/factory.py,sha256=HkareJp_57ud0_Bdd9Kwz3_Rnq2l211sGJgftohFAHg,3589
|
|
320
321
|
tol/sql/auth/__init__.py,sha256=e3JuwugXmXobklqZ1Mt1w03qPgb1WdUaJVM7oblzHyk,202
|
|
@@ -351,7 +352,7 @@ tol/validators/regex.py,sha256=dLAi_vQt9_DsT6wQZmbYC7X5-Wp15l0leUE6XkPaItg,2602
|
|
|
351
352
|
tol/validators/regex_by_value.py,sha256=XM5EnT4vgD17rfpR3bUE9I56IemSw26BI9MZtMakd4E,2582
|
|
352
353
|
tol/validators/specimens_have_same_taxon.py,sha256=BaJcZ38ZprPcuGTIorSxxC9uGN0_lj6HS6B54EObcuY,2183
|
|
353
354
|
tol/validators/sts_fields.py,sha256=aYbzy15btEg4-ocDT1qrspe7-atoWRrOJ_KmuPU6J14,8936
|
|
354
|
-
tol/validators/taxon_matches_goat.py,sha256
|
|
355
|
+
tol/validators/taxon_matches_goat.py,sha256=lYZ0qwPver9wXJm2ekv_6KcC49MugVXD9t1IAxPGG2Q,3492
|
|
355
356
|
tol/validators/tolid.py,sha256=VOb6lNFz11H_0KaWX8_nvsw8xJEa6KrjB0p-5lkcqog,3885
|
|
356
357
|
tol/validators/types.py,sha256=jMVpckRp8RS93f7usf58YH_K-5rKWgZIYs7bO9dHhQc,2914
|
|
357
358
|
tol/validators/unique_value_check.py,sha256=sFvDooYkKeORvULGEOTsgIcxlbe0AXDWxY3Gbr3j0KI,1282
|
|
@@ -360,9 +361,9 @@ tol/validators/unique_whole_organisms.py,sha256=RdqA1GzIf3LTdrmNGGdxv0aW2udDY2P9
|
|
|
360
361
|
tol/validators/value_check.py,sha256=DdNx_B1gns01zgBg5N6Bwia46Aukw6MAteM-M37Kv1k,1122
|
|
361
362
|
tol/validators/interfaces/__init__.py,sha256=jtOxnwnwqV_29xjmmMcS_kvlt-pQiWwQYJn2YRP07_w,172
|
|
362
363
|
tol/validators/interfaces/condition_evaluator.py,sha256=nj8Cb8hi47OBy6OVNfeLhF-Pjwtr8MiOSymYL6hfVes,3766
|
|
363
|
-
tol_sdk-1.8.
|
|
364
|
-
tol_sdk-1.8.
|
|
365
|
-
tol_sdk-1.8.
|
|
366
|
-
tol_sdk-1.8.
|
|
367
|
-
tol_sdk-1.8.
|
|
368
|
-
tol_sdk-1.8.
|
|
364
|
+
tol_sdk-1.8.10.dist-info/licenses/LICENSE,sha256=RF9Jacy-9BpUAQQ20INhTgtaNBkmdTolYCHtrrkM2-8,1077
|
|
365
|
+
tol_sdk-1.8.10.dist-info/METADATA,sha256=8VkqLVdpb45ixAI3mGjagWB0lDmyJYxfrSp6tTr-NFg,3143
|
|
366
|
+
tol_sdk-1.8.10.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
367
|
+
tol_sdk-1.8.10.dist-info/entry_points.txt,sha256=jH3HfTwxjzog7E3lq8CKpUWGIRY9FSXbyL6CpUmv6D0,36
|
|
368
|
+
tol_sdk-1.8.10.dist-info/top_level.txt,sha256=PwKMQLphyZNvagBoriVbl8uwHXQl8IC1niawVG0iXMM,10
|
|
369
|
+
tol_sdk-1.8.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|