tracdap-runtime 0.8.0b3__py3-none-any.whl → 0.8.0rc1__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.
- tracdap/rt/_impl/core/config_parser.py +55 -37
- tracdap/rt/_impl/core/data.py +63 -32
- tracdap/rt/_impl/core/storage.py +4 -1
- tracdap/rt/_impl/core/struct.py +547 -0
- tracdap/rt/_impl/core/type_system.py +73 -33
- tracdap/rt/_impl/core/validation.py +56 -15
- tracdap/rt/_impl/exec/context.py +64 -10
- tracdap/rt/_impl/exec/dev_mode.py +25 -14
- tracdap/rt/_impl/exec/functions.py +79 -29
- tracdap/rt/_impl/grpc/codec.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2.py +2 -2
- tracdap/rt/_impl/grpc/tracdap/api/internal/runtime_pb2_grpc.py +1 -1
- tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.py +31 -19
- tracdap/rt/_impl/grpc/tracdap/metadata/data_pb2.pyi +48 -2
- tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.py +2 -2
- tracdap/rt/_impl/grpc/tracdap/metadata/object_pb2.pyi +3 -3
- tracdap/rt/_impl/grpc/tracdap/metadata/{stoarge_pb2.py → storage_pb2.py} +3 -3
- tracdap/rt/_impl/static_api.py +9 -1
- tracdap/rt/_plugins/storage_sql.py +12 -5
- tracdap/rt/_version.py +1 -1
- tracdap/rt/api/__init__.py +1 -23
- tracdap/rt/api/constants.py +57 -0
- tracdap/rt/api/experimental.py +32 -0
- tracdap/rt/api/hook.py +11 -0
- tracdap/rt/api/static_api.py +54 -2
- tracdap/rt/config/__init__.py +1 -4
- tracdap/rt/config/common.py +0 -34
- tracdap/rt/config/platform.py +6 -26
- tracdap/rt/metadata/__init__.py +31 -29
- tracdap/rt/metadata/data.py +40 -0
- tracdap/rt/metadata/file.py +2 -0
- tracdap/rt/metadata/object.py +1 -1
- {tracdap_runtime-0.8.0b3.dist-info → tracdap_runtime-0.8.0rc1.dist-info}/METADATA +17 -14
- {tracdap_runtime-0.8.0b3.dist-info → tracdap_runtime-0.8.0rc1.dist-info}/RECORD +39 -38
- {tracdap_runtime-0.8.0b3.dist-info → tracdap_runtime-0.8.0rc1.dist-info}/WHEEL +1 -1
- tracdap/rt/api/file_types.py +0 -29
- /tracdap/rt/_impl/grpc/tracdap/metadata/{stoarge_pb2.pyi → storage_pb2.pyi} +0 -0
- /tracdap/rt/metadata/{stoarge.py → storage.py} +0 -0
- {tracdap_runtime-0.8.0b3.dist-info → tracdap_runtime-0.8.0rc1.dist-info}/LICENSE +0 -0
- {tracdap_runtime-0.8.0b3.dist-info → tracdap_runtime-0.8.0rc1.dist-info}/top_level.txt +0 -0
@@ -16,6 +16,7 @@
|
|
16
16
|
import copy
|
17
17
|
import datetime
|
18
18
|
import abc
|
19
|
+
import io
|
19
20
|
import pathlib
|
20
21
|
import random
|
21
22
|
import dataclasses as dc # noqa
|
@@ -29,6 +30,7 @@ import tracdap.rt._impl.core.type_system as _types
|
|
29
30
|
import tracdap.rt._impl.core.data as _data
|
30
31
|
import tracdap.rt._impl.core.logging as _logging
|
31
32
|
import tracdap.rt._impl.core.storage as _storage
|
33
|
+
import tracdap.rt._impl.core.struct as _struct
|
32
34
|
import tracdap.rt._impl.core.models as _models
|
33
35
|
import tracdap.rt._impl.core.util as _util
|
34
36
|
|
@@ -282,6 +284,13 @@ class DataViewFunc(NodeFunction[_data.DataView]):
|
|
282
284
|
if root_item.object_type == meta.ObjectType.FILE:
|
283
285
|
return _data.DataView.for_file_item(root_item)
|
284
286
|
|
287
|
+
# TODO: Generalize processing across DataView / DataItem types
|
288
|
+
|
289
|
+
if root_item.schema_type == meta.SchemaType.STRUCT:
|
290
|
+
view = _data.DataView.for_trac_schema(self.node.schema)
|
291
|
+
view.parts[root_part_key] = [root_item]
|
292
|
+
return view
|
293
|
+
|
285
294
|
# Everything else is a regular data view
|
286
295
|
if self.node.schema is not None and len(self.node.schema.table.fields) > 0:
|
287
296
|
trac_schema = self.node.schema
|
@@ -488,40 +497,55 @@ class LoadDataFunc( _LoadSaveDataFunc, NodeFunction[_data.DataItem],):
|
|
488
497
|
data_spec = self._choose_data_spec(self.node.spec_id, self.node.spec, ctx)
|
489
498
|
data_copy = self._choose_copy(data_spec.data_item, data_spec.storage_def)
|
490
499
|
|
491
|
-
if data_spec.object_type == _api.ObjectType.
|
492
|
-
return self._load_data(data_spec, data_copy)
|
493
|
-
|
494
|
-
elif data_spec.object_type == _api.ObjectType.FILE:
|
500
|
+
if data_spec.object_type == _api.ObjectType.FILE:
|
495
501
|
return self._load_file(data_copy)
|
496
502
|
|
503
|
+
elif data_spec.schema_type == _api.SchemaType.TABLE:
|
504
|
+
return self._load_table(data_spec, data_copy)
|
505
|
+
|
506
|
+
elif data_spec.schema_type == _api.SchemaType.STRUCT:
|
507
|
+
return self._load_struct(data_copy)
|
508
|
+
|
509
|
+
# TODO: Handle dynamic inputs, they should work for any schema type
|
510
|
+
elif data_spec.schema_type == _api.SchemaType.SCHEMA_TYPE_NOT_SET:
|
511
|
+
return self._load_table(data_spec, data_copy)
|
512
|
+
|
497
513
|
else:
|
498
514
|
raise _ex.EUnexpected()
|
499
515
|
|
500
|
-
def
|
516
|
+
def _load_file(self, data_copy):
|
517
|
+
|
518
|
+
storage = self.storage.get_file_storage(data_copy.storageKey)
|
519
|
+
content = storage.read_bytes(data_copy.storagePath)
|
520
|
+
|
521
|
+
return _data.DataItem.for_file_content(content)
|
522
|
+
|
523
|
+
def _load_table(self, data_spec, data_copy):
|
501
524
|
|
502
525
|
trac_schema = data_spec.schema_def if data_spec.schema_def else data_spec.data_def.schema
|
503
526
|
arrow_schema = _data.DataMapping.trac_to_arrow_schema(trac_schema) if trac_schema else None
|
504
527
|
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
options[opt_key] = _types.MetadataCodec.decode_value(opt_value)
|
528
|
+
storage_options = dict(
|
529
|
+
(opt_key, _types.MetadataCodec.decode_value(opt_value))
|
530
|
+
for opt_key, opt_value in data_spec.storage_def.storageOptions.items())
|
509
531
|
|
510
532
|
storage = self.storage.get_data_storage(data_copy.storageKey)
|
533
|
+
|
511
534
|
table = storage.read_table(
|
512
|
-
data_copy.storagePath,
|
513
|
-
|
514
|
-
arrow_schema,
|
515
|
-
storage_options=options)
|
535
|
+
data_copy.storagePath, data_copy.storageFormat, arrow_schema,
|
536
|
+
storage_options=storage_options)
|
516
537
|
|
517
|
-
return _data.DataItem(
|
538
|
+
return _data.DataItem.for_table(table, table.schema, trac_schema)
|
518
539
|
|
519
|
-
def
|
540
|
+
def _load_struct(self, data_copy):
|
520
541
|
|
521
542
|
storage = self.storage.get_file_storage(data_copy.storageKey)
|
522
|
-
raw_bytes = storage.read_bytes(data_copy.storagePath)
|
523
543
|
|
524
|
-
|
544
|
+
with storage.read_byte_stream(data_copy.storagePath) as stream:
|
545
|
+
with io.TextIOWrapper(stream, "utf-8") as text_stream:
|
546
|
+
struct = _struct.StructProcessor.load_struct(text_stream, data_copy.storageFormat)
|
547
|
+
|
548
|
+
return _data.DataItem.for_struct(struct)
|
525
549
|
|
526
550
|
|
527
551
|
class SaveDataFunc(_LoadSaveDataFunc, NodeFunction[_data.DataSpec]):
|
@@ -541,24 +565,40 @@ class SaveDataFunc(_LoadSaveDataFunc, NodeFunction[_data.DataSpec]):
|
|
541
565
|
|
542
566
|
# Do not save empty outputs (optional outputs that were not produced)
|
543
567
|
if data_item.is_empty():
|
544
|
-
return _data.DataSpec.create_empty_spec(data_item.object_type)
|
568
|
+
return _data.DataSpec.create_empty_spec(data_item.object_type, data_item.schema_type)
|
545
569
|
|
546
|
-
if data_item.object_type == _api.ObjectType.
|
547
|
-
return self._save_data(data_item, data_spec, data_copy)
|
548
|
-
|
549
|
-
elif data_item.object_type == _api.ObjectType.FILE:
|
570
|
+
if data_item.object_type == _api.ObjectType.FILE:
|
550
571
|
return self._save_file(data_item, data_spec, data_copy)
|
551
572
|
|
573
|
+
elif data_item.schema_type == _api.SchemaType.TABLE:
|
574
|
+
return self._save_table(data_item, data_spec, data_copy)
|
575
|
+
|
576
|
+
elif data_item.schema_type == _api.SchemaType.STRUCT:
|
577
|
+
return self._save_struct(data_item, data_spec, data_copy)
|
578
|
+
|
552
579
|
else:
|
553
580
|
raise _ex.EUnexpected()
|
554
581
|
|
555
|
-
def
|
582
|
+
def _save_file(self, data_item, data_spec, data_copy):
|
583
|
+
|
584
|
+
if data_item.content is None:
|
585
|
+
raise _ex.EUnexpected()
|
586
|
+
|
587
|
+
storage = self.storage.get_file_storage(data_copy.storageKey)
|
588
|
+
storage.write_bytes(data_copy.storagePath, data_item.content)
|
589
|
+
|
590
|
+
data_spec = copy.deepcopy(data_spec)
|
591
|
+
data_spec.file_def.size = len(data_item.content)
|
592
|
+
|
593
|
+
return data_spec
|
594
|
+
|
595
|
+
def _save_table(self, data_item, data_spec, data_copy):
|
556
596
|
|
557
597
|
# Current implementation will always put an Arrow table in the data item
|
558
598
|
# Empty tables are allowed, so explicitly check if table is None
|
559
599
|
# Testing "if not data_item.table" will fail for empty tables
|
560
600
|
|
561
|
-
if data_item.
|
601
|
+
if data_item.content is None:
|
562
602
|
raise _ex.EUnexpected()
|
563
603
|
|
564
604
|
# Decode options (metadata values) from the storage definition
|
@@ -569,7 +609,7 @@ class SaveDataFunc(_LoadSaveDataFunc, NodeFunction[_data.DataSpec]):
|
|
569
609
|
storage = self.storage.get_data_storage(data_copy.storageKey)
|
570
610
|
storage.write_table(
|
571
611
|
data_copy.storagePath, data_copy.storageFormat,
|
572
|
-
data_item.
|
612
|
+
data_item.content,
|
573
613
|
storage_options=options, overwrite=False)
|
574
614
|
|
575
615
|
data_spec = copy.deepcopy(data_spec)
|
@@ -580,16 +620,26 @@ class SaveDataFunc(_LoadSaveDataFunc, NodeFunction[_data.DataSpec]):
|
|
580
620
|
|
581
621
|
return data_spec
|
582
622
|
|
583
|
-
def
|
623
|
+
def _save_struct(self, data_item, data_spec, data_copy):
|
584
624
|
|
585
|
-
if data_item.
|
625
|
+
if data_item.content is None:
|
586
626
|
raise _ex.EUnexpected()
|
587
627
|
|
628
|
+
struct_data = data_item.content
|
629
|
+
storage_format = data_copy.storageFormat
|
630
|
+
|
588
631
|
storage = self.storage.get_file_storage(data_copy.storageKey)
|
589
|
-
|
632
|
+
|
633
|
+
# Using the text wrapper closes the stream early, which is inefficient in the data layer
|
634
|
+
# Supporting text IO directly from the storage API would allow working with text streams more naturally
|
635
|
+
with storage.write_byte_stream(data_copy.storagePath) as stream:
|
636
|
+
with io.TextIOWrapper(stream, "utf-8") as text_stream:
|
637
|
+
_struct.StructProcessor.save_struct(struct_data, text_stream, storage_format)
|
590
638
|
|
591
639
|
data_spec = copy.deepcopy(data_spec)
|
592
|
-
|
640
|
+
|
641
|
+
if data_spec.data_def.schema is None and data_spec.data_def.schemaId is None:
|
642
|
+
data_spec.data_def.schema = data_item.trac_schema
|
593
643
|
|
594
644
|
return data_spec
|
595
645
|
|
tracdap/rt/_impl/grpc/codec.py
CHANGED
@@ -24,7 +24,7 @@ import tracdap.rt._impl.grpc.tracdap.metadata.object_id_pb2 as object_id_pb2
|
|
24
24
|
import tracdap.rt._impl.grpc.tracdap.metadata.object_pb2 as object_pb2
|
25
25
|
from tracdap.rt._impl.grpc.tracdap.metadata import model_pb2
|
26
26
|
import tracdap.rt._impl.grpc.tracdap.metadata.data_pb2 as data_pb2
|
27
|
-
import tracdap.rt._impl.grpc.tracdap.metadata.
|
27
|
+
import tracdap.rt._impl.grpc.tracdap.metadata.storage_pb2 as storage_pb2
|
28
28
|
|
29
29
|
from google.protobuf import message as _message
|
30
30
|
|
@@ -18,14 +18,14 @@ from tracdap.rt._impl.grpc.tracdap.metadata import object_pb2 as tracdap_dot_rt_
|
|
18
18
|
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
|
19
19
|
|
20
20
|
|
21
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n8tracdap/rt/_impl/grpc/tracdap/api/internal/runtime.proto\x12\x14tracdap.api.internal\x1a\x36tracdap/rt/_impl/grpc/tracdap/metadata/object_id.proto\x1a\x30tracdap/rt/_impl/grpc/tracdap/metadata/job.proto\x1a\x33tracdap/rt/_impl/grpc/tracdap/metadata/object.proto\x1a\x1cgoogle/api/annotations.proto\"6\n\x16RuntimeListJobsRequest\x12\x12\n\x05limit\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_limit\"O\n\x17RuntimeListJobsResponse\x12\x34\n\x04jobs\x18\x01 \x03(\x0b\x32&.tracdap.api.internal.RuntimeJobStatus\"f\n\x15RuntimeJobInfoRequest\x12\x34\n\x0bjobSelector\x18\x01 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelectorH\x00\x12\x10\n\x06jobKey\x18\x02 \x01(\tH\x00\x42\x05\n\x03job\"\x9f\x01\n\x10RuntimeJobStatus\x12*\n\x05jobId\x18\x01 \x01(\x0b\x32\x1b.tracdap.metadata.TagHeader\x12\x33\n\nstatusCode\x18\x02 \x01(\x0e\x32\x1f.tracdap.metadata.JobStatusCode\x12\x15\n\rstatusMessage\x18\x03 \x01(\t\x12\x13\n\x0b\x65rrorDetail\x18\x04 \x01(\t\"\xa4\x02\n\x10RuntimeJobResult\x12*\n\x05jobId\x18\x01 \x01(\x0b\x32\x1b.tracdap.metadata.TagHeader\x12\x33\n\nstatusCode\x18\x02 \x01(\x0e\x32\x1f.tracdap.metadata.JobStatusCode\x12\x15\n\rstatusMessage\x18\x03 \x01(\t\x12\x44\n\x07results\x18\x04 \x03(\x0b\x32\x33.tracdap.api.internal.RuntimeJobResult.ResultsEntry\x1aR\n\x0cResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".tracdap.metadata.ObjectDefinition:\x02\x38\x01\x32\x95\x03\n\x0eTracRuntimeApi\x12{\n\x08listJobs\x12,.tracdap.api.internal.RuntimeListJobsRequest\x1a-.tracdap.api.internal.RuntimeListJobsResponse\"\x12\x82\xd3\xe4\x93\x02\x0c\x12\n/list-jobs\x12\x81\x01\n\x0cgetJobStatus\x12+.tracdap.api.internal.RuntimeJobInfoRequest\x1a&.tracdap.api.internal.RuntimeJobStatus\"\x1c\x82\xd3\xe4\x93\x02\x16\x12\x14/job-status/{jobKey}\x12\x81\x01\n\x0cgetJobResult\x12+.tracdap.api.internal.RuntimeJobInfoRequest\x1a&.tracdap.api.internal.RuntimeJobResult\"\x1c\x82\xd3\xe4\x93\x02\x16\x12\x14/job-result/{jobKey}
|
21
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n8tracdap/rt/_impl/grpc/tracdap/api/internal/runtime.proto\x12\x14tracdap.api.internal\x1a\x36tracdap/rt/_impl/grpc/tracdap/metadata/object_id.proto\x1a\x30tracdap/rt/_impl/grpc/tracdap/metadata/job.proto\x1a\x33tracdap/rt/_impl/grpc/tracdap/metadata/object.proto\x1a\x1cgoogle/api/annotations.proto\"6\n\x16RuntimeListJobsRequest\x12\x12\n\x05limit\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_limit\"O\n\x17RuntimeListJobsResponse\x12\x34\n\x04jobs\x18\x01 \x03(\x0b\x32&.tracdap.api.internal.RuntimeJobStatus\"f\n\x15RuntimeJobInfoRequest\x12\x34\n\x0bjobSelector\x18\x01 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelectorH\x00\x12\x10\n\x06jobKey\x18\x02 \x01(\tH\x00\x42\x05\n\x03job\"\x9f\x01\n\x10RuntimeJobStatus\x12*\n\x05jobId\x18\x01 \x01(\x0b\x32\x1b.tracdap.metadata.TagHeader\x12\x33\n\nstatusCode\x18\x02 \x01(\x0e\x32\x1f.tracdap.metadata.JobStatusCode\x12\x15\n\rstatusMessage\x18\x03 \x01(\t\x12\x13\n\x0b\x65rrorDetail\x18\x04 \x01(\t\"\xa4\x02\n\x10RuntimeJobResult\x12*\n\x05jobId\x18\x01 \x01(\x0b\x32\x1b.tracdap.metadata.TagHeader\x12\x33\n\nstatusCode\x18\x02 \x01(\x0e\x32\x1f.tracdap.metadata.JobStatusCode\x12\x15\n\rstatusMessage\x18\x03 \x01(\t\x12\x44\n\x07results\x18\x04 \x03(\x0b\x32\x33.tracdap.api.internal.RuntimeJobResult.ResultsEntry\x1aR\n\x0cResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".tracdap.metadata.ObjectDefinition:\x02\x38\x01\x32\x95\x03\n\x0eTracRuntimeApi\x12{\n\x08listJobs\x12,.tracdap.api.internal.RuntimeListJobsRequest\x1a-.tracdap.api.internal.RuntimeListJobsResponse\"\x12\x82\xd3\xe4\x93\x02\x0c\x12\n/list-jobs\x12\x81\x01\n\x0cgetJobStatus\x12+.tracdap.api.internal.RuntimeJobInfoRequest\x1a&.tracdap.api.internal.RuntimeJobStatus\"\x1c\x82\xd3\xe4\x93\x02\x16\x12\x14/job-status/{jobKey}\x12\x81\x01\n\x0cgetJobResult\x12+.tracdap.api.internal.RuntimeJobInfoRequest\x1a&.tracdap.api.internal.RuntimeJobResult\"\x1c\x82\xd3\xe4\x93\x02\x16\x12\x14/job-result/{jobKey}B7\n\x1eorg.finos.tracdap.api.internalB\x13RuntimeServiceProtoP\x01\x62\x06proto3')
|
22
22
|
|
23
23
|
_globals = globals()
|
24
24
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
25
25
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'tracdap.rt._impl.grpc.tracdap.api.internal.runtime_pb2', _globals)
|
26
26
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
27
27
|
_globals['DESCRIPTOR']._options = None
|
28
|
-
_globals['DESCRIPTOR']._serialized_options = b'\n\036org.finos.tracdap.api.
|
28
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\036org.finos.tracdap.api.internalB\023RuntimeServiceProtoP\001'
|
29
29
|
_globals['_RUNTIMEJOBRESULT_RESULTSENTRY']._options = None
|
30
30
|
_globals['_RUNTIMEJOBRESULT_RESULTSENTRY']._serialized_options = b'8\001'
|
31
31
|
_globals['_TRACRUNTIMEAPI'].methods_by_name['listJobs']._options = None
|
@@ -5,7 +5,7 @@ import warnings
|
|
5
5
|
|
6
6
|
from tracdap.rt._impl.grpc.tracdap.api.internal import runtime_pb2 as tracdap_dot_rt_dot___impl_dot_grpc_dot_tracdap_dot_api_dot_internal_dot_runtime__pb2
|
7
7
|
|
8
|
-
GRPC_GENERATED_VERSION = '1.
|
8
|
+
GRPC_GENERATED_VERSION = '1.70.0'
|
9
9
|
GRPC_VERSION = grpc.__version__
|
10
10
|
_version_not_supported = False
|
11
11
|
|
@@ -16,7 +16,7 @@ from tracdap.rt._impl.grpc.tracdap.metadata import type_pb2 as tracdap_dot_rt_do
|
|
16
16
|
from tracdap.rt._impl.grpc.tracdap.metadata import object_id_pb2 as tracdap_dot_rt_dot___impl_dot_grpc_dot_tracdap_dot_metadata_dot_object__id__pb2
|
17
17
|
|
18
18
|
|
19
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n1tracdap/rt/_impl/grpc/tracdap/metadata/data.proto\x12\x10tracdap.metadata\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/type.proto\x1a\x36tracdap/rt/_impl/grpc/tracdap/metadata/object_id.proto\"\xe7\x01\n\x0b\x46ieldSchema\x12\x11\n\tfieldName\x18\x01 \x01(\t\x12\x12\n\nfieldOrder\x18\x02 \x01(\x11\x12.\n\tfieldType\x18\x03 \x01(\x0e\x32\x1b.tracdap.metadata.BasicType\x12\r\n\x05label\x18\x04 \x01(\t\x12\x13\n\x0b\x62usinessKey\x18\x05 \x01(\x08\x12\x13\n\x0b\x63\x61tegorical\x18\x06 \x01(\x08\x12\x14\n\x07notNull\x18\x08 \x01(\x08H\x00\x88\x01\x01\x12\x17\n\nformatCode\x18\x07 \x01(\tH\x01\x88\x01\x01\x42\n\n\x08_notNullB\r\n\x0b_formatCode\"<\n\x0bTableSchema\x12-\n\x06\x66ields\x18\x01 \x03(\x0b\x32\x1d.tracdap.metadata.FieldSchema\"\
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n1tracdap/rt/_impl/grpc/tracdap/metadata/data.proto\x12\x10tracdap.metadata\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/type.proto\x1a\x36tracdap/rt/_impl/grpc/tracdap/metadata/object_id.proto\"\xe7\x01\n\x0b\x46ieldSchema\x12\x11\n\tfieldName\x18\x01 \x01(\t\x12\x12\n\nfieldOrder\x18\x02 \x01(\x11\x12.\n\tfieldType\x18\x03 \x01(\x0e\x32\x1b.tracdap.metadata.BasicType\x12\r\n\x05label\x18\x04 \x01(\t\x12\x13\n\x0b\x62usinessKey\x18\x05 \x01(\x08\x12\x13\n\x0b\x63\x61tegorical\x18\x06 \x01(\x08\x12\x14\n\x07notNull\x18\x08 \x01(\x08H\x00\x88\x01\x01\x12\x17\n\nformatCode\x18\x07 \x01(\tH\x01\x88\x01\x01\x42\n\n\x08_notNullB\r\n\x0b_formatCode\"<\n\x0bTableSchema\x12-\n\x06\x66ields\x18\x01 \x03(\x0b\x32\x1d.tracdap.metadata.FieldSchema\"\x9c\x02\n\x0bStructField\x12\x33\n\tfieldType\x18\x03 \x01(\x0b\x32 .tracdap.metadata.TypeDescriptor\x12\r\n\x05label\x18\x04 \x01(\t\x12\x13\n\x0b\x62usinessKey\x18\x05 \x01(\x08\x12\x13\n\x0b\x63\x61tegorical\x18\x06 \x01(\x08\x12\x14\n\x07notNull\x18\x08 \x01(\x08H\x00\x88\x01\x01\x12\x17\n\nformatCode\x18\x07 \x01(\tH\x01\x88\x01\x01\x12-\n\x0c\x64\x65\x66\x61ultValue\x18\t \x01(\x0b\x32\x17.tracdap.metadata.Value\x12\x17\n\nstructType\x18\n \x01(\tH\x02\x88\x01\x01\x42\n\n\x08_notNullB\r\n\x0b_formatCodeB\r\n\x0b_structType\"\xaf\x02\n\x0cStructSchema\x12:\n\x06\x66ields\x18\x01 \x03(\x0b\x32*.tracdap.metadata.StructSchema.FieldsEntry\x12\x42\n\nnamedTypes\x18\x02 \x03(\x0b\x32..tracdap.metadata.StructSchema.NamedTypesEntry\x1aL\n\x0b\x46ieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.StructField:\x02\x38\x01\x1aQ\n\x0fNamedTypesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12-\n\x05value\x18\x02 \x01(\x0b\x32\x1e.tracdap.metadata.StructSchema:\x02\x38\x01\"\xe5\x01\n\x10SchemaDefinition\x12\x30\n\nschemaType\x18\x01 \x01(\x0e\x32\x1c.tracdap.metadata.SchemaType\x12,\n\x08partType\x18\x02 \x01(\x0e\x32\x1a.tracdap.metadata.PartType\x12.\n\x05table\x18\x03 \x01(\x0b\x32\x1d.tracdap.metadata.TableSchemaH\x00\x12\x30\n\x06struct\x18\x04 \x01(\x0b\x32\x1e.tracdap.metadata.StructSchemaH\x00\x42\x0f\n\rschemaDetails\"\x81\x02\n\x07PartKey\x12\x11\n\topaqueKey\x18\x01 \x01(\t\x12,\n\x08partType\x18\x02 \x01(\x0e\x32\x1a.tracdap.metadata.PartType\x12+\n\npartValues\x18\x03 \x03(\x0b\x32\x17.tracdap.metadata.Value\x12\x32\n\x0cpartRangeMin\x18\x04 \x01(\x0b\x32\x17.tracdap.metadata.ValueH\x00\x88\x01\x01\x12\x32\n\x0cpartRangeMax\x18\x05 \x01(\x0b\x32\x17.tracdap.metadata.ValueH\x01\x88\x01\x01\x42\x0f\n\r_partRangeMinB\x0f\n\r_partRangeMax\"\xba\x04\n\x0e\x44\x61taDefinition\x12\x31\n\x08schemaId\x18\x01 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelectorH\x00\x12\x34\n\x06schema\x18\x02 \x01(\x0b\x32\".tracdap.metadata.SchemaDefinitionH\x00\x12:\n\x05parts\x18\x03 \x03(\x0b\x32+.tracdap.metadata.DataDefinition.PartsEntry\x12\x30\n\tstorageId\x18\x04 \x01(\x0b\x32\x1d.tracdap.metadata.TagSelector\x1a-\n\x05\x44\x65lta\x12\x12\n\ndeltaIndex\x18\x01 \x01(\r\x12\x10\n\x08\x64\x61taItem\x18\x02 \x01(\t\x1aQ\n\x04Snap\x12\x11\n\tsnapIndex\x18\x01 \x01(\r\x12\x36\n\x06\x64\x65ltas\x18\x02 \x03(\x0b\x32&.tracdap.metadata.DataDefinition.Delta\x1ag\n\x04Part\x12*\n\x07partKey\x18\x01 \x01(\x0b\x32\x19.tracdap.metadata.PartKey\x12\x33\n\x04snap\x18\x02 \x01(\x0b\x32%.tracdap.metadata.DataDefinition.Snap\x1aS\n\nPartsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x34\n\x05value\x18\x02 \x01(\x0b\x32%.tracdap.metadata.DataDefinition.Part:\x02\x38\x01\x42\x11\n\x0fschemaSpecifier*<\n\nSchemaType\x12\x17\n\x13SCHEMA_TYPE_NOT_SET\x10\x00\x12\t\n\x05TABLE\x10\x01\x12\n\n\x06STRUCT\x10\x02*?\n\x08PartType\x12\r\n\tPART_ROOT\x10\x00\x12\x11\n\rPART_BY_RANGE\x10\x01\x12\x11\n\rPART_BY_VALUE\x10\x02\x42\x1e\n\x1aorg.finos.tracdap.metadataP\x01\x62\x06proto3')
|
20
20
|
|
21
21
|
_globals = globals()
|
22
22
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -24,28 +24,40 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'tracdap.rt._impl.grpc.tracd
|
|
24
24
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
25
25
|
_globals['DESCRIPTOR']._options = None
|
26
26
|
_globals['DESCRIPTOR']._serialized_options = b'\n\032org.finos.tracdap.metadataP\001'
|
27
|
+
_globals['_STRUCTSCHEMA_FIELDSENTRY']._options = None
|
28
|
+
_globals['_STRUCTSCHEMA_FIELDSENTRY']._serialized_options = b'8\001'
|
29
|
+
_globals['_STRUCTSCHEMA_NAMEDTYPESENTRY']._options = None
|
30
|
+
_globals['_STRUCTSCHEMA_NAMEDTYPESENTRY']._serialized_options = b'8\001'
|
27
31
|
_globals['_DATADEFINITION_PARTSENTRY']._options = None
|
28
32
|
_globals['_DATADEFINITION_PARTSENTRY']._serialized_options = b'8\001'
|
29
|
-
_globals['_SCHEMATYPE']._serialized_start=
|
30
|
-
_globals['_SCHEMATYPE']._serialized_end=
|
31
|
-
_globals['_PARTTYPE']._serialized_start=
|
32
|
-
_globals['_PARTTYPE']._serialized_end=
|
33
|
+
_globals['_SCHEMATYPE']._serialized_start=2132
|
34
|
+
_globals['_SCHEMATYPE']._serialized_end=2192
|
35
|
+
_globals['_PARTTYPE']._serialized_start=2194
|
36
|
+
_globals['_PARTTYPE']._serialized_end=2257
|
33
37
|
_globals['_FIELDSCHEMA']._serialized_start=179
|
34
38
|
_globals['_FIELDSCHEMA']._serialized_end=410
|
35
39
|
_globals['_TABLESCHEMA']._serialized_start=412
|
36
40
|
_globals['_TABLESCHEMA']._serialized_end=472
|
37
|
-
_globals['
|
38
|
-
_globals['
|
39
|
-
_globals['
|
40
|
-
_globals['
|
41
|
-
_globals['
|
42
|
-
_globals['
|
43
|
-
_globals['
|
44
|
-
_globals['
|
45
|
-
_globals['
|
46
|
-
_globals['
|
47
|
-
_globals['
|
48
|
-
_globals['
|
49
|
-
_globals['
|
50
|
-
_globals['
|
41
|
+
_globals['_STRUCTFIELD']._serialized_start=475
|
42
|
+
_globals['_STRUCTFIELD']._serialized_end=759
|
43
|
+
_globals['_STRUCTSCHEMA']._serialized_start=762
|
44
|
+
_globals['_STRUCTSCHEMA']._serialized_end=1065
|
45
|
+
_globals['_STRUCTSCHEMA_FIELDSENTRY']._serialized_start=906
|
46
|
+
_globals['_STRUCTSCHEMA_FIELDSENTRY']._serialized_end=982
|
47
|
+
_globals['_STRUCTSCHEMA_NAMEDTYPESENTRY']._serialized_start=984
|
48
|
+
_globals['_STRUCTSCHEMA_NAMEDTYPESENTRY']._serialized_end=1065
|
49
|
+
_globals['_SCHEMADEFINITION']._serialized_start=1068
|
50
|
+
_globals['_SCHEMADEFINITION']._serialized_end=1297
|
51
|
+
_globals['_PARTKEY']._serialized_start=1300
|
52
|
+
_globals['_PARTKEY']._serialized_end=1557
|
53
|
+
_globals['_DATADEFINITION']._serialized_start=1560
|
54
|
+
_globals['_DATADEFINITION']._serialized_end=2130
|
55
|
+
_globals['_DATADEFINITION_DELTA']._serialized_start=1793
|
56
|
+
_globals['_DATADEFINITION_DELTA']._serialized_end=1838
|
57
|
+
_globals['_DATADEFINITION_SNAP']._serialized_start=1840
|
58
|
+
_globals['_DATADEFINITION_SNAP']._serialized_end=1921
|
59
|
+
_globals['_DATADEFINITION_PART']._serialized_start=1923
|
60
|
+
_globals['_DATADEFINITION_PART']._serialized_end=2026
|
61
|
+
_globals['_DATADEFINITION_PARTSENTRY']._serialized_start=2028
|
62
|
+
_globals['_DATADEFINITION_PARTSENTRY']._serialized_end=2111
|
51
63
|
# @@protoc_insertion_point(module_scope)
|
@@ -12,6 +12,7 @@ class SchemaType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
12
12
|
__slots__ = ()
|
13
13
|
SCHEMA_TYPE_NOT_SET: _ClassVar[SchemaType]
|
14
14
|
TABLE: _ClassVar[SchemaType]
|
15
|
+
STRUCT: _ClassVar[SchemaType]
|
15
16
|
|
16
17
|
class PartType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
17
18
|
__slots__ = ()
|
@@ -20,6 +21,7 @@ class PartType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
20
21
|
PART_BY_VALUE: _ClassVar[PartType]
|
21
22
|
SCHEMA_TYPE_NOT_SET: SchemaType
|
22
23
|
TABLE: SchemaType
|
24
|
+
STRUCT: SchemaType
|
23
25
|
PART_ROOT: PartType
|
24
26
|
PART_BY_RANGE: PartType
|
25
27
|
PART_BY_VALUE: PartType
|
@@ -50,15 +52,59 @@ class TableSchema(_message.Message):
|
|
50
52
|
fields: _containers.RepeatedCompositeFieldContainer[FieldSchema]
|
51
53
|
def __init__(self, fields: _Optional[_Iterable[_Union[FieldSchema, _Mapping]]] = ...) -> None: ...
|
52
54
|
|
55
|
+
class StructField(_message.Message):
|
56
|
+
__slots__ = ("fieldType", "label", "businessKey", "categorical", "notNull", "formatCode", "defaultValue", "structType")
|
57
|
+
FIELDTYPE_FIELD_NUMBER: _ClassVar[int]
|
58
|
+
LABEL_FIELD_NUMBER: _ClassVar[int]
|
59
|
+
BUSINESSKEY_FIELD_NUMBER: _ClassVar[int]
|
60
|
+
CATEGORICAL_FIELD_NUMBER: _ClassVar[int]
|
61
|
+
NOTNULL_FIELD_NUMBER: _ClassVar[int]
|
62
|
+
FORMATCODE_FIELD_NUMBER: _ClassVar[int]
|
63
|
+
DEFAULTVALUE_FIELD_NUMBER: _ClassVar[int]
|
64
|
+
STRUCTTYPE_FIELD_NUMBER: _ClassVar[int]
|
65
|
+
fieldType: _type_pb2.TypeDescriptor
|
66
|
+
label: str
|
67
|
+
businessKey: bool
|
68
|
+
categorical: bool
|
69
|
+
notNull: bool
|
70
|
+
formatCode: str
|
71
|
+
defaultValue: _type_pb2.Value
|
72
|
+
structType: str
|
73
|
+
def __init__(self, fieldType: _Optional[_Union[_type_pb2.TypeDescriptor, _Mapping]] = ..., label: _Optional[str] = ..., businessKey: bool = ..., categorical: bool = ..., notNull: bool = ..., formatCode: _Optional[str] = ..., defaultValue: _Optional[_Union[_type_pb2.Value, _Mapping]] = ..., structType: _Optional[str] = ...) -> None: ...
|
74
|
+
|
75
|
+
class StructSchema(_message.Message):
|
76
|
+
__slots__ = ("fields", "namedTypes")
|
77
|
+
class FieldsEntry(_message.Message):
|
78
|
+
__slots__ = ("key", "value")
|
79
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
80
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
81
|
+
key: str
|
82
|
+
value: StructField
|
83
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[StructField, _Mapping]] = ...) -> None: ...
|
84
|
+
class NamedTypesEntry(_message.Message):
|
85
|
+
__slots__ = ("key", "value")
|
86
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
87
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
88
|
+
key: str
|
89
|
+
value: StructSchema
|
90
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[StructSchema, _Mapping]] = ...) -> None: ...
|
91
|
+
FIELDS_FIELD_NUMBER: _ClassVar[int]
|
92
|
+
NAMEDTYPES_FIELD_NUMBER: _ClassVar[int]
|
93
|
+
fields: _containers.MessageMap[str, StructField]
|
94
|
+
namedTypes: _containers.MessageMap[str, StructSchema]
|
95
|
+
def __init__(self, fields: _Optional[_Mapping[str, StructField]] = ..., namedTypes: _Optional[_Mapping[str, StructSchema]] = ...) -> None: ...
|
96
|
+
|
53
97
|
class SchemaDefinition(_message.Message):
|
54
|
-
__slots__ = ("schemaType", "partType", "table")
|
98
|
+
__slots__ = ("schemaType", "partType", "table", "struct")
|
55
99
|
SCHEMATYPE_FIELD_NUMBER: _ClassVar[int]
|
56
100
|
PARTTYPE_FIELD_NUMBER: _ClassVar[int]
|
57
101
|
TABLE_FIELD_NUMBER: _ClassVar[int]
|
102
|
+
STRUCT_FIELD_NUMBER: _ClassVar[int]
|
58
103
|
schemaType: SchemaType
|
59
104
|
partType: PartType
|
60
105
|
table: TableSchema
|
61
|
-
|
106
|
+
struct: StructSchema
|
107
|
+
def __init__(self, schemaType: _Optional[_Union[SchemaType, str]] = ..., partType: _Optional[_Union[PartType, str]] = ..., table: _Optional[_Union[TableSchema, _Mapping]] = ..., struct: _Optional[_Union[StructSchema, _Mapping]] = ...) -> None: ...
|
62
108
|
|
63
109
|
class PartKey(_message.Message):
|
64
110
|
__slots__ = ("opaqueKey", "partType", "partValues", "partRangeMin", "partRangeMax")
|
@@ -20,10 +20,10 @@ from tracdap.rt._impl.grpc.tracdap.metadata import flow_pb2 as tracdap_dot_rt_do
|
|
20
20
|
from tracdap.rt._impl.grpc.tracdap.metadata import job_pb2 as tracdap_dot_rt_dot___impl_dot_grpc_dot_tracdap_dot_metadata_dot_job__pb2
|
21
21
|
from tracdap.rt._impl.grpc.tracdap.metadata import file_pb2 as tracdap_dot_rt_dot___impl_dot_grpc_dot_tracdap_dot_metadata_dot_file__pb2
|
22
22
|
from tracdap.rt._impl.grpc.tracdap.metadata import custom_pb2 as tracdap_dot_rt_dot___impl_dot_grpc_dot_tracdap_dot_metadata_dot_custom__pb2
|
23
|
-
from tracdap.rt._impl.grpc.tracdap.metadata import
|
23
|
+
from tracdap.rt._impl.grpc.tracdap.metadata import storage_pb2 as tracdap_dot_rt_dot___impl_dot_grpc_dot_tracdap_dot_metadata_dot_storage__pb2
|
24
24
|
|
25
25
|
|
26
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n3tracdap/rt/_impl/grpc/tracdap/metadata/object.proto\x12\x10tracdap.metadata\x1a\x36tracdap/rt/_impl/grpc/tracdap/metadata/object_id.proto\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/type.proto\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/data.proto\x1a\x32tracdap/rt/_impl/grpc/tracdap/metadata/model.proto\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/flow.proto\x1a\x30tracdap/rt/_impl/grpc/tracdap/metadata/job.proto\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/file.proto\x1a\x33tracdap/rt/_impl/grpc/tracdap/metadata/custom.proto\x1a\x34tracdap/rt/_impl/grpc/tracdap/metadata/
|
26
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n3tracdap/rt/_impl/grpc/tracdap/metadata/object.proto\x12\x10tracdap.metadata\x1a\x36tracdap/rt/_impl/grpc/tracdap/metadata/object_id.proto\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/type.proto\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/data.proto\x1a\x32tracdap/rt/_impl/grpc/tracdap/metadata/model.proto\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/flow.proto\x1a\x30tracdap/rt/_impl/grpc/tracdap/metadata/job.proto\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/file.proto\x1a\x33tracdap/rt/_impl/grpc/tracdap/metadata/custom.proto\x1a\x34tracdap/rt/_impl/grpc/tracdap/metadata/storage.proto\"\xbd\x05\n\x10ObjectDefinition\x12\x30\n\nobjectType\x18\x01 \x01(\x0e\x32\x1c.tracdap.metadata.ObjectType\x12\x30\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32 .tracdap.metadata.DataDefinitionH\x00\x12\x32\n\x05model\x18\x03 \x01(\x0b\x32!.tracdap.metadata.ModelDefinitionH\x00\x12\x30\n\x04\x66low\x18\x04 \x01(\x0b\x32 .tracdap.metadata.FlowDefinitionH\x00\x12.\n\x03job\x18\x05 \x01(\x0b\x32\x1f.tracdap.metadata.JobDefinitionH\x00\x12\x30\n\x04\x66ile\x18\x06 \x01(\x0b\x32 .tracdap.metadata.FileDefinitionH\x00\x12\x34\n\x06\x63ustom\x18\x07 \x01(\x0b\x32\".tracdap.metadata.CustomDefinitionH\x00\x12\x36\n\x07storage\x18\x08 \x01(\x0b\x32#.tracdap.metadata.StorageDefinitionH\x00\x12\x34\n\x06schema\x18\t \x01(\x0b\x32\".tracdap.metadata.SchemaDefinitionH\x00\x12\x34\n\x06result\x18\n \x01(\x0b\x32\".tracdap.metadata.ResultDefinitionH\x00\x12H\n\x0bobjectProps\x18\x64 \x03(\x0b\x32\x33.tracdap.metadata.ObjectDefinition.ObjectPropsEntry\x1aK\n\x10ObjectPropsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.tracdap.metadata.Value:\x02\x38\x01\x42\x0c\n\ndefinitionB2\n\x1aorg.finos.tracdap.metadataB\x12ObjectProtoWrapperP\x01\x62\x06proto3')
|
27
27
|
|
28
28
|
_globals = globals()
|
29
29
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -6,7 +6,7 @@ from tracdap.rt._impl.grpc.tracdap.metadata import flow_pb2 as _flow_pb2
|
|
6
6
|
from tracdap.rt._impl.grpc.tracdap.metadata import job_pb2 as _job_pb2
|
7
7
|
from tracdap.rt._impl.grpc.tracdap.metadata import file_pb2 as _file_pb2
|
8
8
|
from tracdap.rt._impl.grpc.tracdap.metadata import custom_pb2 as _custom_pb2
|
9
|
-
from tracdap.rt._impl.grpc.tracdap.metadata import
|
9
|
+
from tracdap.rt._impl.grpc.tracdap.metadata import storage_pb2 as _storage_pb2
|
10
10
|
from google.protobuf.internal import containers as _containers
|
11
11
|
from google.protobuf import descriptor as _descriptor
|
12
12
|
from google.protobuf import message as _message
|
@@ -41,8 +41,8 @@ class ObjectDefinition(_message.Message):
|
|
41
41
|
job: _job_pb2.JobDefinition
|
42
42
|
file: _file_pb2.FileDefinition
|
43
43
|
custom: _custom_pb2.CustomDefinition
|
44
|
-
storage:
|
44
|
+
storage: _storage_pb2.StorageDefinition
|
45
45
|
schema: _data_pb2.SchemaDefinition
|
46
46
|
result: _job_pb2.ResultDefinition
|
47
47
|
objectProps: _containers.MessageMap[str, _type_pb2.Value]
|
48
|
-
def __init__(self, objectType: _Optional[_Union[_object_id_pb2.ObjectType, str]] = ..., data: _Optional[_Union[_data_pb2.DataDefinition, _Mapping]] = ..., model: _Optional[_Union[_model_pb2.ModelDefinition, _Mapping]] = ..., flow: _Optional[_Union[_flow_pb2.FlowDefinition, _Mapping]] = ..., job: _Optional[_Union[_job_pb2.JobDefinition, _Mapping]] = ..., file: _Optional[_Union[_file_pb2.FileDefinition, _Mapping]] = ..., custom: _Optional[_Union[_custom_pb2.CustomDefinition, _Mapping]] = ..., storage: _Optional[_Union[
|
48
|
+
def __init__(self, objectType: _Optional[_Union[_object_id_pb2.ObjectType, str]] = ..., data: _Optional[_Union[_data_pb2.DataDefinition, _Mapping]] = ..., model: _Optional[_Union[_model_pb2.ModelDefinition, _Mapping]] = ..., flow: _Optional[_Union[_flow_pb2.FlowDefinition, _Mapping]] = ..., job: _Optional[_Union[_job_pb2.JobDefinition, _Mapping]] = ..., file: _Optional[_Union[_file_pb2.FileDefinition, _Mapping]] = ..., custom: _Optional[_Union[_custom_pb2.CustomDefinition, _Mapping]] = ..., storage: _Optional[_Union[_storage_pb2.StorageDefinition, _Mapping]] = ..., schema: _Optional[_Union[_data_pb2.SchemaDefinition, _Mapping]] = ..., result: _Optional[_Union[_job_pb2.ResultDefinition, _Mapping]] = ..., objectProps: _Optional[_Mapping[str, _type_pb2.Value]] = ...) -> None: ...
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
-
# source: tracdap/rt/_impl/grpc/tracdap/metadata/
|
3
|
+
# source: tracdap/rt/_impl/grpc/tracdap/metadata/storage.proto
|
4
4
|
# Protobuf Python Version: 4.25.3
|
5
5
|
"""Generated protocol buffer code."""
|
6
6
|
from google.protobuf import descriptor as _descriptor
|
@@ -15,11 +15,11 @@ _sym_db = _symbol_database.Default()
|
|
15
15
|
from tracdap.rt._impl.grpc.tracdap.metadata import type_pb2 as tracdap_dot_rt_dot___impl_dot_grpc_dot_tracdap_dot_metadata_dot_type__pb2
|
16
16
|
|
17
17
|
|
18
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n4tracdap/rt/_impl/grpc/tracdap/metadata/
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n4tracdap/rt/_impl/grpc/tracdap/metadata/storage.proto\x12\x10tracdap.metadata\x1a\x31tracdap/rt/_impl/grpc/tracdap/metadata/type.proto\"\xd2\x02\n\x0bStorageCopy\x12\x12\n\nstorageKey\x18\x01 \x01(\t\x12\x13\n\x0bstoragePath\x18\x02 \x01(\t\x12\x15\n\rstorageFormat\x18\x03 \x01(\t\x12\x30\n\ncopyStatus\x18\x04 \x01(\x0e\x32\x1c.tracdap.metadata.CopyStatus\x12\x36\n\rcopyTimestamp\x18\x05 \x01(\x0b\x32\x1f.tracdap.metadata.DatetimeValue\x12I\n\x0estorageOptions\x18\x06 \x03(\x0b\x32\x31.tracdap.metadata.StorageCopy.StorageOptionsEntry\x1aN\n\x13StorageOptionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.tracdap.metadata.Value:\x02\x38\x01\"\xdc\x01\n\x12StorageIncarnation\x12-\n\x06\x63opies\x18\x01 \x03(\x0b\x32\x1d.tracdap.metadata.StorageCopy\x12\x18\n\x10incarnationIndex\x18\x02 \x01(\x05\x12=\n\x14incarnationTimestamp\x18\x03 \x01(\x0b\x32\x1f.tracdap.metadata.DatetimeValue\x12>\n\x11incarnationStatus\x18\x04 \x01(\x0e\x32#.tracdap.metadata.IncarnationStatus\"I\n\x0bStorageItem\x12:\n\x0cincarnations\x18\x01 \x03(\x0b\x32$.tracdap.metadata.StorageIncarnation\"\xe1\x02\n\x11StorageDefinition\x12\x45\n\tdataItems\x18\x01 \x03(\x0b\x32\x32.tracdap.metadata.StorageDefinition.DataItemsEntry\x12O\n\x0estorageOptions\x18\x03 \x03(\x0b\x32\x37.tracdap.metadata.StorageDefinition.StorageOptionsEntry\x1aO\n\x0e\x44\x61taItemsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.tracdap.metadata.StorageItem:\x02\x38\x01\x1aN\n\x13StorageOptionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.tracdap.metadata.Value:\x02\x38\x01J\x04\x08\x02\x10\x03R\rstorageFormat*L\n\nCopyStatus\x12\x17\n\x13\x43OPY_STATUS_NOT_SET\x10\x00\x12\x12\n\x0e\x43OPY_AVAILABLE\x10\x01\x12\x11\n\rCOPY_EXPUNGED\x10\x02*h\n\x11IncarnationStatus\x12\x1e\n\x1aINCARNATION_STATUS_NOT_SET\x10\x00\x12\x19\n\x15INCARNATION_AVAILABLE\x10\x01\x12\x18\n\x14INCARNATION_EXPUNGED\x10\x02\x42\x1e\n\x1aorg.finos.tracdap.metadataP\x01\x62\x06proto3')
|
19
19
|
|
20
20
|
_globals = globals()
|
21
21
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
22
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'tracdap.rt._impl.grpc.tracdap.metadata.
|
22
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'tracdap.rt._impl.grpc.tracdap.metadata.storage_pb2', _globals)
|
23
23
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
24
24
|
_globals['DESCRIPTOR']._options = None
|
25
25
|
_globals['DESCRIPTOR']._serialized_options = b'\n\032org.finos.tracdap.metadataP\001'
|
tracdap/rt/_impl/static_api.py
CHANGED
@@ -21,6 +21,7 @@ import tracdap.rt.metadata as _meta
|
|
21
21
|
import tracdap.rt.exceptions as _ex
|
22
22
|
import tracdap.rt._impl.core.data as _data
|
23
23
|
import tracdap.rt._impl.core.schemas as _schemas
|
24
|
+
import tracdap.rt._impl.core.struct as _struct
|
24
25
|
import tracdap.rt._impl.core.type_system as _type_system
|
25
26
|
import tracdap.rt._impl.core.validation as _val
|
26
27
|
|
@@ -55,7 +56,7 @@ class StaticApiImpl(_StaticApiHook):
|
|
55
56
|
if not _val.is_primitive_type(entry_type):
|
56
57
|
raise _ex.EModelValidation(f"Maps can only contain primitive types, [{entry_type}] is not primitive")
|
57
58
|
|
58
|
-
return _meta.TypeDescriptor(_meta.BasicType.MAP,
|
59
|
+
return _meta.TypeDescriptor(_meta.BasicType.MAP, mapType=_meta.TypeDescriptor(entry_type))
|
59
60
|
|
60
61
|
def define_attribute(
|
61
62
|
self, attr_name: str, attr_value: _tp.Any,
|
@@ -150,6 +151,13 @@ class StaticApiImpl(_StaticApiHook):
|
|
150
151
|
notNull=not_null,
|
151
152
|
formatCode=format_code)
|
152
153
|
|
154
|
+
def define_struct(self, python_type: type[_api.STRUCT_TYPE]):
|
155
|
+
|
156
|
+
_val.validate_signature(self.define_struct, python_type)
|
157
|
+
|
158
|
+
struct_schema = _struct.StructProcessor.define_struct(python_type)
|
159
|
+
return _meta.SchemaDefinition(schemaType=_meta.SchemaType.STRUCT, struct=struct_schema)
|
160
|
+
|
153
161
|
def define_schema(
|
154
162
|
self, *fields: _tp.Union[_meta.FieldSchema, _tp.List[_meta.FieldSchema]],
|
155
163
|
schema_type: _meta.SchemaType = _meta.SchemaType.TABLE, dynamic: bool = False) \
|
@@ -268,10 +268,18 @@ plugins.PluginManager.register_plugin(IStorageProvider, SqlStorageProvider, ["SQ
|
|
268
268
|
|
269
269
|
|
270
270
|
try:
|
271
|
-
|
272
271
|
import sqlalchemy as sqla # noqa
|
273
272
|
import sqlalchemy.exc as sqla_exc # noqa
|
274
273
|
|
274
|
+
# Only 2.x versions of SQL Alchemy are currently supported
|
275
|
+
sqla_supported = sqla.__version__.startswith("2.")
|
276
|
+
|
277
|
+
except ModuleNotFoundError:
|
278
|
+
sqla = None
|
279
|
+
sqla_supported = False
|
280
|
+
|
281
|
+
if sqla_supported:
|
282
|
+
|
275
283
|
class SqlAlchemyDriver(ISqlDriver):
|
276
284
|
|
277
285
|
def __init__(self, properties: tp.Dict[str, str]):
|
@@ -336,7 +344,7 @@ try:
|
|
336
344
|
|
337
345
|
class ConnectionWrapper(DbApiWrapper.Connection):
|
338
346
|
|
339
|
-
def __init__(self, conn: sqla.Connection):
|
347
|
+
def __init__(self, conn: "sqla.Connection"):
|
340
348
|
self.__conn = conn
|
341
349
|
|
342
350
|
def close(self):
|
@@ -355,7 +363,7 @@ try:
|
|
355
363
|
|
356
364
|
arraysize: int = 1000
|
357
365
|
|
358
|
-
def __init__(self, conn: sqla.Connection):
|
366
|
+
def __init__(self, conn: "sqla.Connection"):
|
359
367
|
self.__conn = conn
|
360
368
|
self.__result: tp.Optional[sqla.CursorResult] = None
|
361
369
|
|
@@ -414,5 +422,4 @@ try:
|
|
414
422
|
|
415
423
|
plugins.PluginManager.register_plugin(ISqlDriver, SqlAlchemyDriver, ["alchemy"])
|
416
424
|
|
417
|
-
|
418
|
-
pass
|
425
|
+
|
tracdap/rt/_version.py
CHANGED
tracdap/rt/api/__init__.py
CHANGED
@@ -23,29 +23,7 @@ from tracdap.rt.metadata import * # noqa DOCGEN_REMOVE
|
|
23
23
|
|
24
24
|
# static_api overrides some metadata types for backwards compatibility with pre-0.8 versions
|
25
25
|
# Make sure it is last in the list
|
26
|
-
from .
|
26
|
+
from .constants import *
|
27
27
|
from .model_api import *
|
28
28
|
from .static_api import *
|
29
29
|
|
30
|
-
# Map basic types into the root of the API package
|
31
|
-
|
32
|
-
BOOLEAN = BasicType.BOOLEAN
|
33
|
-
"""Synonym for :py:attr:`BasicType.BOOLEAN <tracdap.rt.metadata.BasicType.BOOLEAN>`"""
|
34
|
-
|
35
|
-
INTEGER = BasicType.INTEGER
|
36
|
-
"""Synonym for :py:attr:`BasicType.INTEGER <tracdap.rt.metadata.BasicType.INTEGER>`"""
|
37
|
-
|
38
|
-
FLOAT = BasicType.FLOAT
|
39
|
-
"""Synonym for :py:attr:`BasicType.FLOAT <tracdap.rt.metadata.BasicType.FLOAT>`"""
|
40
|
-
|
41
|
-
DECIMAL = BasicType.DECIMAL
|
42
|
-
"""Synonym for :py:attr:`BasicType.DECIMAL <tracdap.rt.metadata.BasicType.DECIMAL>`"""
|
43
|
-
|
44
|
-
STRING = BasicType.STRING
|
45
|
-
"""Synonym for :py:attr:`BasicType.STRING <tracdap.rt.metadata.BasicType.STRING>`"""
|
46
|
-
|
47
|
-
DATE = BasicType.DATE
|
48
|
-
"""Synonym for :py:attr:`BasicType.DATE <tracdap.rt.metadata.BasicType.DATE>`"""
|
49
|
-
|
50
|
-
DATETIME = BasicType.DATETIME
|
51
|
-
"""Synonym for :py:attr:`BasicType.DATETIME <tracdap.rt.metadata.BasicType.DATETIME>`"""
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Licensed to the Fintech Open Source Foundation (FINOS) under one or
|
2
|
+
# more contributor license agreements. See the NOTICE file distributed
|
3
|
+
# with this work for additional information regarding copyright ownership.
|
4
|
+
# FINOS licenses this file to you under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with the
|
6
|
+
# License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
import tracdap.rt.metadata
|
17
|
+
|
18
|
+
|
19
|
+
class CommonFileTypes:
|
20
|
+
|
21
|
+
"""
|
22
|
+
A collection of common :py:class:`FileTypes <tracdap.rt.metadata.FileType>` to use as model inputs and outputs
|
23
|
+
"""
|
24
|
+
|
25
|
+
TXT = tracdap.rt.metadata.FileType("txt", "text/plain")
|
26
|
+
|
27
|
+
JPG = tracdap.rt.metadata.FileType("jpg", "image/jpeg")
|
28
|
+
PNG = tracdap.rt.metadata.FileType("png", "image/png")
|
29
|
+
SVG = tracdap.rt.metadata.FileType("svg", "image/svg+xml")
|
30
|
+
|
31
|
+
WORD = tracdap.rt.metadata.FileType("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
|
32
|
+
EXCEL = tracdap.rt.metadata.FileType("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
33
|
+
POWERPOINT = tracdap.rt.metadata.FileType("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation")
|
34
|
+
|
35
|
+
|
36
|
+
# Map basic types into the root of the API package
|
37
|
+
|
38
|
+
BOOLEAN = tracdap.rt.metadata.BasicType.BOOLEAN
|
39
|
+
"""Synonym for :py:attr:`BasicType.BOOLEAN <tracdap.rt.metadata.BasicType.BOOLEAN>`"""
|
40
|
+
|
41
|
+
INTEGER = tracdap.rt.metadata.BasicType.INTEGER
|
42
|
+
"""Synonym for :py:attr:`BasicType.INTEGER <tracdap.rt.metadata.BasicType.INTEGER>`"""
|
43
|
+
|
44
|
+
FLOAT = tracdap.rt.metadata.BasicType.FLOAT
|
45
|
+
"""Synonym for :py:attr:`BasicType.FLOAT <tracdap.rt.metadata.BasicType.FLOAT>`"""
|
46
|
+
|
47
|
+
DECIMAL = tracdap.rt.metadata.BasicType.DECIMAL
|
48
|
+
"""Synonym for :py:attr:`BasicType.DECIMAL <tracdap.rt.metadata.BasicType.DECIMAL>`"""
|
49
|
+
|
50
|
+
STRING = tracdap.rt.metadata.BasicType.STRING
|
51
|
+
"""Synonym for :py:attr:`BasicType.STRING <tracdap.rt.metadata.BasicType.STRING>`"""
|
52
|
+
|
53
|
+
DATE = tracdap.rt.metadata.BasicType.DATE
|
54
|
+
"""Synonym for :py:attr:`BasicType.DATE <tracdap.rt.metadata.BasicType.DATE>`"""
|
55
|
+
|
56
|
+
DATETIME = tracdap.rt.metadata.BasicType.DATETIME
|
57
|
+
"""Synonym for :py:attr:`BasicType.DATETIME <tracdap.rt.metadata.BasicType.DATETIME>`"""
|