deriva-ml 1.10.1__py3-none-any.whl → 1.11.0__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.
- deriva_ml/dataset.py +1 -1
- deriva_ml/dataset_bag.py +10 -3
- deriva_ml/demo_catalog.py +84 -78
- deriva_ml/deriva_definitions.py +2 -2
- deriva_ml/deriva_ml_base.py +85 -121
- deriva_ml/deriva_model.py +25 -0
- deriva_ml/execution.py +386 -309
- deriva_ml/feature.py +1 -2
- deriva_ml/schema_setup/create_schema.py +223 -183
- deriva_ml/upload.py +95 -232
- {deriva_ml-1.10.1.dist-info → deriva_ml-1.11.0.dist-info}/METADATA +2 -1
- deriva_ml-1.11.0.dist-info/RECORD +27 -0
- deriva_ml-1.10.1.dist-info/RECORD +0 -27
- {deriva_ml-1.10.1.dist-info → deriva_ml-1.11.0.dist-info}/WHEEL +0 -0
- {deriva_ml-1.10.1.dist-info → deriva_ml-1.11.0.dist-info}/entry_points.txt +0 -0
- {deriva_ml-1.10.1.dist-info → deriva_ml-1.11.0.dist-info}/licenses/LICENSE +0 -0
- {deriva_ml-1.10.1.dist-info → deriva_ml-1.11.0.dist-info}/top_level.txt +0 -0
deriva_ml/deriva_model.py
CHANGED
|
@@ -126,6 +126,31 @@ class DerivaModel:
|
|
|
126
126
|
table = self.name_to_table(table_name)
|
|
127
127
|
return table.is_association(unqualified=unqualified, pure=pure)
|
|
128
128
|
|
|
129
|
+
def find_association(self, table1: Table | str, table2: Table | str) -> Table:
|
|
130
|
+
"""Given two tables, return an association table that connects the two.
|
|
131
|
+
|
|
132
|
+
Raises"
|
|
133
|
+
DerivaML exception if there is either not an association table or more than one association table.
|
|
134
|
+
"""
|
|
135
|
+
table1 = self.name_to_table(table1)
|
|
136
|
+
table2 = self.name_to_table(table2)
|
|
137
|
+
|
|
138
|
+
tables = [
|
|
139
|
+
a.table
|
|
140
|
+
for a in table1.find_associations(pure=False)
|
|
141
|
+
if (t := a.other_fkeys.pop().pk_table) == table2
|
|
142
|
+
]
|
|
143
|
+
if len(tables) == 1:
|
|
144
|
+
return tables[0]
|
|
145
|
+
elif len(tables) == 0:
|
|
146
|
+
raise DerivaMLException(
|
|
147
|
+
f"No association tables found between {table1.name} and {table2.name}."
|
|
148
|
+
)
|
|
149
|
+
else:
|
|
150
|
+
raise DerivaMLException(
|
|
151
|
+
f"There are {len(tables)} association tables between {table1.name} and {table2.name}."
|
|
152
|
+
)
|
|
153
|
+
|
|
129
154
|
def is_asset(self, table_name: str | Table) -> bool:
|
|
130
155
|
"""True if the specified table is an asset table.
|
|
131
156
|
|