pydpm_xl 0.2.5rc2__py3-none-any.whl → 0.2.6__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.
py_dpm/__init__.py CHANGED
@@ -41,7 +41,7 @@ Available packages:
41
41
  - pydpm.api: Main APIs for migration, syntax, and semantic analysis
42
42
  """
43
43
 
44
- __version__ = "0.2.5rc2"
44
+ __version__ = "0.2.6"
45
45
  __author__ = "MeaningfulData S.L."
46
46
  __email__ = "info@meaningfuldata.eu"
47
47
  __license__ = "GPL-3.0-or-later"
py_dpm/api/__init__.py CHANGED
@@ -12,7 +12,6 @@ from py_dpm.api.dpm_xl import (
12
12
  ASTGeneratorAPI,
13
13
  OperationScopesAPI,
14
14
  generate_complete_ast,
15
- generate_complete_batch,
16
15
  generate_enriched_ast,
17
16
  enrich_ast_with_metadata,
18
17
  parse_with_data_fields,
@@ -43,7 +42,6 @@ __all__ = [
43
42
  "OperationScopesAPI",
44
43
  # Complete AST functions (backwards compatibility)
45
44
  "generate_complete_ast",
46
- "generate_complete_batch",
47
45
  "generate_enriched_ast",
48
46
  "enrich_ast_with_metadata",
49
47
  "parse_with_data_fields",
@@ -461,6 +461,7 @@ class DataDictionaryAPI:
461
461
  TableVersion.code.label("table_version_code"),
462
462
  ItemCategory.code.label("property_code"),
463
463
  DataType.name.label("data_type_name"),
464
+ DataType.code.label("data_type_code"),
464
465
  )
465
466
  .select_from(DataType)
466
467
  .join(Property, DataType.datatypeid == Property.datatypeid)
@@ -498,6 +499,7 @@ class DataDictionaryAPI:
498
499
  "table_version_code": r.table_version_code,
499
500
  "property_code": r.property_code,
500
501
  "data_type_name": r.data_type_name,
502
+ "data_type_code": r.data_type_code,
501
503
  }
502
504
  for r in results
503
505
  ]
@@ -213,6 +213,7 @@ class ExplorerQueryAPI:
213
213
  row_code: Optional[str] = None,
214
214
  column_code: Optional[str] = None,
215
215
  sheet_code: Optional[str] = None,
216
+ module_code: Optional[str] = None,
216
217
  release_id: Optional[int] = None,
217
218
  release_code: Optional[str] = None,
218
219
  date: Optional[str] = None,
@@ -220,7 +221,7 @@ class ExplorerQueryAPI:
220
221
  """
221
222
  Resolve variable information from a cell address (table/row/column/sheet).
222
223
 
223
- Row, column and sheet codes are optional and are only used when
224
+ Row, column, sheet and module codes are optional and are only used when
224
225
  provided. Release parameters follow the standard semantics; if none
225
226
  are given, only active module versions are considered.
226
227
  """
@@ -230,7 +231,80 @@ class ExplorerQueryAPI:
230
231
  row_code=row_code,
231
232
  column_code=column_code,
232
233
  sheet_code=sheet_code,
234
+ module_code=module_code,
233
235
  release_id=release_id,
234
236
  release_code=release_code,
235
237
  date=date,
236
238
  )
239
+
240
+ def get_variable_by_code(
241
+ self,
242
+ variable_code: str,
243
+ release_id: Optional[int] = None,
244
+ release_code: Optional[str] = None,
245
+ ) -> Optional[Dict[str, Any]]:
246
+ """
247
+ Get variable_id and variable_vid for a given variable code.
248
+
249
+ This is useful for resolving precondition variable references like {v_C_01.00}
250
+ where the variable code corresponds to a table's filing indicator variable.
251
+
252
+ Args:
253
+ variable_code: The variable code to look up (e.g., "C_01.00")
254
+ release_id: Optional release ID to filter by (mutually exclusive with release_code)
255
+ release_code: Optional release code to filter by (mutually exclusive with release_id)
256
+
257
+ Returns:
258
+ Dict with variable_id, variable_vid, variable_code, variable_name if found,
259
+ None otherwise.
260
+
261
+ Example:
262
+ >>> api = ExplorerQueryAPI()
263
+ >>> result = api.get_variable_by_code("C_01.00", release_code="4.2")
264
+ >>> print(result)
265
+ {'variable_id': 2201, 'variable_vid': 2201, 'variable_code': 'C_01.00', 'variable_name': '...'}
266
+ """
267
+ return ExplorerQuery.get_variable_by_code(
268
+ self.api.session,
269
+ variable_code=variable_code,
270
+ release_id=release_id,
271
+ release_code=release_code,
272
+ )
273
+
274
+ def get_variables_by_codes(
275
+ self,
276
+ variable_codes: List[str],
277
+ release_id: Optional[int] = None,
278
+ release_code: Optional[str] = None,
279
+ ) -> Dict[str, Dict[str, Any]]:
280
+ """
281
+ Batch lookup of variable_id and variable_vid for multiple variable codes.
282
+
283
+ This is more efficient than calling get_variable_by_code multiple times
284
+ when resolving multiple precondition variables, as it performs a single
285
+ database query.
286
+
287
+ Args:
288
+ variable_codes: List of variable codes to look up
289
+ release_id: Optional release ID to filter by (mutually exclusive with release_code)
290
+ release_code: Optional release code to filter by (mutually exclusive with release_id)
291
+
292
+ Returns:
293
+ Dict mapping variable_code to {variable_id, variable_vid, variable_code, variable_name}.
294
+ Only includes codes that were found in the database.
295
+
296
+ Example:
297
+ >>> api = ExplorerQueryAPI()
298
+ >>> result = api.get_variables_by_codes(["C_01.00", "C_47.00"], release_code="4.2")
299
+ >>> print(result)
300
+ {
301
+ 'C_01.00': {'variable_id': 2201, 'variable_vid': 2201, ...},
302
+ 'C_47.00': {'variable_id': 1935, 'variable_vid': 1935, ...}
303
+ }
304
+ """
305
+ return ExplorerQuery.get_variables_by_codes(
306
+ self.api.session,
307
+ variable_codes=variable_codes,
308
+ release_id=release_id,
309
+ release_code=release_code,
310
+ )
@@ -12,7 +12,6 @@ from py_dpm.api.dpm_xl.operation_scopes import OperationScopesAPI
12
12
  # Backwards-compatible standalone functions (delegate to ASTGeneratorAPI)
13
13
  from py_dpm.api.dpm_xl.complete_ast import (
14
14
  generate_complete_ast,
15
- generate_complete_batch,
16
15
  generate_enriched_ast,
17
16
  enrich_ast_with_metadata,
18
17
  parse_with_data_fields,
@@ -26,7 +25,6 @@ __all__ = [
26
25
  "OperationScopesAPI",
27
26
  # Standalone functions (backwards compatibility)
28
27
  "generate_complete_ast",
29
- "generate_complete_batch",
30
28
  "generate_enriched_ast",
31
29
  "enrich_ast_with_metadata",
32
30
  "parse_with_data_fields",