tracdap-runtime 0.8.0b2__py3-none-any.whl → 0.8.0b4__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/__init__.py +14 -0
- tracdap/rt/_impl/{config_parser.py → core/config_parser.py} +59 -35
- tracdap/rt/_impl/{data.py → core/data.py} +64 -33
- tracdap/rt/_impl/{models.py → core/models.py} +6 -6
- tracdap/rt/_impl/{repos.py → core/repos.py} +1 -1
- tracdap/rt/_impl/{schemas.py → core/schemas.py} +4 -4
- tracdap/rt/_impl/{shim.py → core/shim.py} +3 -3
- tracdap/rt/_impl/{storage.py → core/storage.py} +8 -5
- tracdap/rt/_impl/core/struct.py +547 -0
- tracdap/rt/_impl/{type_system.py → core/type_system.py} +73 -33
- tracdap/rt/_impl/{validation.py → core/validation.py} +58 -17
- tracdap/rt/_impl/exec/__init__.py +14 -0
- tracdap/rt/{_exec → _impl/exec}/actors.py +9 -12
- tracdap/rt/{_exec → _impl/exec}/context.py +70 -16
- tracdap/rt/{_exec → _impl/exec}/dev_mode.py +31 -20
- tracdap/rt/{_exec → _impl/exec}/engine.py +9 -9
- tracdap/rt/{_exec → _impl/exec}/functions.py +89 -40
- tracdap/rt/{_exec → _impl/exec}/graph.py +1 -1
- tracdap/rt/{_exec → _impl/exec}/graph_builder.py +2 -2
- tracdap/rt/{_exec → _impl/grpc}/server.py +4 -4
- 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/{_exec → _impl}/runtime.py +13 -13
- tracdap/rt/_impl/static_api.py +13 -5
- tracdap/rt/_plugins/format_csv.py +1 -1
- tracdap/rt/_plugins/storage_sql.py +13 -6
- tracdap/rt/_version.py +1 -1
- tracdap/rt/api/experimental.py +32 -0
- tracdap/rt/api/hook.py +11 -0
- tracdap/rt/config/__init__.py +8 -10
- tracdap/rt/config/common.py +0 -34
- tracdap/rt/config/platform.py +14 -26
- tracdap/rt/ext/embed.py +2 -2
- tracdap/rt/ext/plugins.py +2 -2
- tracdap/rt/launch/launch.py +3 -3
- tracdap/rt/metadata/__init__.py +11 -9
- tracdap/rt/metadata/data.py +40 -0
- {tracdap_runtime-0.8.0b2.dist-info → tracdap_runtime-0.8.0b4.dist-info}/METADATA +15 -13
- {tracdap_runtime-0.8.0b2.dist-info → tracdap_runtime-0.8.0b4.dist-info}/RECORD +47 -45
- {tracdap_runtime-0.8.0b2.dist-info → tracdap_runtime-0.8.0b4.dist-info}/WHEEL +1 -1
- tracdap/rt/_exec/__init__.py +0 -0
- /tracdap/rt/_impl/{guard_rails.py → core/guard_rails.py} +0 -0
- /tracdap/rt/_impl/{logging.py → core/logging.py} +0 -0
- /tracdap/rt/_impl/{util.py → core/util.py} +0 -0
- {tracdap_runtime-0.8.0b2.dist-info → tracdap_runtime-0.8.0b4.dist-info}/LICENSE +0 -0
- {tracdap_runtime-0.8.0b2.dist-info → tracdap_runtime-0.8.0b4.dist-info}/top_level.txt +0 -0
@@ -23,15 +23,15 @@ import typing as tp
|
|
23
23
|
import tracdap.rt.metadata as _meta
|
24
24
|
import tracdap.rt.config as _cfg
|
25
25
|
import tracdap.rt.exceptions as _ex
|
26
|
-
import tracdap.rt.
|
27
|
-
import tracdap.rt.
|
28
|
-
import tracdap.rt.
|
29
|
-
import tracdap.rt._impl.config_parser as _cfg_p
|
30
|
-
import tracdap.rt._impl.data as _data
|
31
|
-
import tracdap.rt._impl.logging as _logging
|
32
|
-
import tracdap.rt._impl.models as _models
|
33
|
-
import tracdap.rt._impl.storage as _storage
|
34
|
-
import tracdap.rt._impl.util as _util
|
26
|
+
import tracdap.rt._impl.exec.actors as _actors
|
27
|
+
import tracdap.rt._impl.exec.graph_builder as _graph
|
28
|
+
import tracdap.rt._impl.exec.functions as _func
|
29
|
+
import tracdap.rt._impl.core.config_parser as _cfg_p
|
30
|
+
import tracdap.rt._impl.core.data as _data
|
31
|
+
import tracdap.rt._impl.core.logging as _logging
|
32
|
+
import tracdap.rt._impl.core.models as _models
|
33
|
+
import tracdap.rt._impl.core.storage as _storage
|
34
|
+
import tracdap.rt._impl.core.util as _util
|
35
35
|
|
36
36
|
from .graph import NodeId
|
37
37
|
|
@@ -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
|
@@ -23,18 +24,18 @@ import dataclasses as dc # noqa
|
|
23
24
|
import tracdap.rt.api as _api
|
24
25
|
import tracdap.rt.config as _config
|
25
26
|
import tracdap.rt.exceptions as _ex
|
26
|
-
import tracdap.rt.
|
27
|
-
import tracdap.rt.
|
28
|
-
import tracdap.rt._impl.
|
29
|
-
import tracdap.rt._impl.
|
30
|
-
import tracdap.rt._impl.
|
31
|
-
import tracdap.rt._impl.
|
32
|
-
import tracdap.rt._impl.
|
33
|
-
import tracdap.rt._impl.models as _models
|
34
|
-
import tracdap.rt._impl.util as _util
|
27
|
+
import tracdap.rt._impl.exec.context as _ctx
|
28
|
+
import tracdap.rt._impl.exec.graph_builder as _graph
|
29
|
+
import tracdap.rt._impl.core.type_system as _types
|
30
|
+
import tracdap.rt._impl.core.data as _data
|
31
|
+
import tracdap.rt._impl.core.logging as _logging
|
32
|
+
import tracdap.rt._impl.core.storage as _storage
|
33
|
+
import tracdap.rt._impl.core.struct as _struct
|
34
|
+
import tracdap.rt._impl.core.models as _models
|
35
|
+
import tracdap.rt._impl.core.util as _util
|
35
36
|
|
36
|
-
from tracdap.rt.
|
37
|
-
from tracdap.rt.
|
37
|
+
from tracdap.rt._impl.exec.graph import *
|
38
|
+
from tracdap.rt._impl.exec.graph import _T
|
38
39
|
|
39
40
|
|
40
41
|
class NodeContext:
|
@@ -283,6 +284,13 @@ class DataViewFunc(NodeFunction[_data.DataView]):
|
|
283
284
|
if root_item.object_type == meta.ObjectType.FILE:
|
284
285
|
return _data.DataView.for_file_item(root_item)
|
285
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
|
+
|
286
294
|
# Everything else is a regular data view
|
287
295
|
if self.node.schema is not None and len(self.node.schema.table.fields) > 0:
|
288
296
|
trac_schema = self.node.schema
|
@@ -489,40 +497,55 @@ class LoadDataFunc( _LoadSaveDataFunc, NodeFunction[_data.DataItem],):
|
|
489
497
|
data_spec = self._choose_data_spec(self.node.spec_id, self.node.spec, ctx)
|
490
498
|
data_copy = self._choose_copy(data_spec.data_item, data_spec.storage_def)
|
491
499
|
|
492
|
-
if data_spec.object_type == _api.ObjectType.
|
493
|
-
return self._load_data(data_spec, data_copy)
|
494
|
-
|
495
|
-
elif data_spec.object_type == _api.ObjectType.FILE:
|
500
|
+
if data_spec.object_type == _api.ObjectType.FILE:
|
496
501
|
return self._load_file(data_copy)
|
497
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
|
+
|
498
513
|
else:
|
499
514
|
raise _ex.EUnexpected()
|
500
515
|
|
501
|
-
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):
|
502
524
|
|
503
525
|
trac_schema = data_spec.schema_def if data_spec.schema_def else data_spec.data_def.schema
|
504
526
|
arrow_schema = _data.DataMapping.trac_to_arrow_schema(trac_schema) if trac_schema else None
|
505
527
|
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
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())
|
510
531
|
|
511
532
|
storage = self.storage.get_data_storage(data_copy.storageKey)
|
533
|
+
|
512
534
|
table = storage.read_table(
|
513
|
-
data_copy.storagePath,
|
514
|
-
|
515
|
-
arrow_schema,
|
516
|
-
storage_options=options)
|
535
|
+
data_copy.storagePath, data_copy.storageFormat, arrow_schema,
|
536
|
+
storage_options=storage_options)
|
517
537
|
|
518
|
-
return _data.DataItem(
|
538
|
+
return _data.DataItem.for_table(table, table.schema, trac_schema)
|
519
539
|
|
520
|
-
def
|
540
|
+
def _load_struct(self, data_copy):
|
521
541
|
|
522
542
|
storage = self.storage.get_file_storage(data_copy.storageKey)
|
523
|
-
raw_bytes = storage.read_bytes(data_copy.storagePath)
|
524
543
|
|
525
|
-
|
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)
|
526
549
|
|
527
550
|
|
528
551
|
class SaveDataFunc(_LoadSaveDataFunc, NodeFunction[_data.DataSpec]):
|
@@ -542,24 +565,40 @@ class SaveDataFunc(_LoadSaveDataFunc, NodeFunction[_data.DataSpec]):
|
|
542
565
|
|
543
566
|
# Do not save empty outputs (optional outputs that were not produced)
|
544
567
|
if data_item.is_empty():
|
545
|
-
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)
|
546
569
|
|
547
|
-
if data_item.object_type == _api.ObjectType.
|
548
|
-
return self._save_data(data_item, data_spec, data_copy)
|
549
|
-
|
550
|
-
elif data_item.object_type == _api.ObjectType.FILE:
|
570
|
+
if data_item.object_type == _api.ObjectType.FILE:
|
551
571
|
return self._save_file(data_item, data_spec, data_copy)
|
552
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
|
+
|
553
579
|
else:
|
554
580
|
raise _ex.EUnexpected()
|
555
581
|
|
556
|
-
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):
|
557
596
|
|
558
597
|
# Current implementation will always put an Arrow table in the data item
|
559
598
|
# Empty tables are allowed, so explicitly check if table is None
|
560
599
|
# Testing "if not data_item.table" will fail for empty tables
|
561
600
|
|
562
|
-
if data_item.
|
601
|
+
if data_item.content is None:
|
563
602
|
raise _ex.EUnexpected()
|
564
603
|
|
565
604
|
# Decode options (metadata values) from the storage definition
|
@@ -570,7 +609,7 @@ class SaveDataFunc(_LoadSaveDataFunc, NodeFunction[_data.DataSpec]):
|
|
570
609
|
storage = self.storage.get_data_storage(data_copy.storageKey)
|
571
610
|
storage.write_table(
|
572
611
|
data_copy.storagePath, data_copy.storageFormat,
|
573
|
-
data_item.
|
612
|
+
data_item.content,
|
574
613
|
storage_options=options, overwrite=False)
|
575
614
|
|
576
615
|
data_spec = copy.deepcopy(data_spec)
|
@@ -581,16 +620,26 @@ class SaveDataFunc(_LoadSaveDataFunc, NodeFunction[_data.DataSpec]):
|
|
581
620
|
|
582
621
|
return data_spec
|
583
622
|
|
584
|
-
def
|
623
|
+
def _save_struct(self, data_item, data_spec, data_copy):
|
585
624
|
|
586
|
-
if data_item.
|
625
|
+
if data_item.content is None:
|
587
626
|
raise _ex.EUnexpected()
|
588
627
|
|
628
|
+
struct_data = data_item.content
|
629
|
+
storage_format = data_copy.storageFormat
|
630
|
+
|
589
631
|
storage = self.storage.get_file_storage(data_copy.storageKey)
|
590
|
-
|
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)
|
591
638
|
|
592
639
|
data_spec = copy.deepcopy(data_spec)
|
593
|
-
|
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
|
594
643
|
|
595
644
|
return data_spec
|
596
645
|
|
@@ -17,8 +17,8 @@ import datetime as _dt
|
|
17
17
|
|
18
18
|
import tracdap.rt.config as config
|
19
19
|
import tracdap.rt.exceptions as _ex
|
20
|
-
import tracdap.rt._impl.data as _data
|
21
|
-
import tracdap.rt._impl.util as _util
|
20
|
+
import tracdap.rt._impl.core.data as _data
|
21
|
+
import tracdap.rt._impl.core.util as _util
|
22
22
|
|
23
23
|
from .graph import *
|
24
24
|
|
@@ -19,10 +19,10 @@ import typing as tp
|
|
19
19
|
|
20
20
|
import tracdap.rt.config as config
|
21
21
|
import tracdap.rt.exceptions as ex
|
22
|
-
import tracdap.rt.
|
23
|
-
import tracdap.rt._impl.grpc.codec as codec
|
24
|
-
import tracdap.rt._impl.logging as logging
|
25
|
-
import tracdap.rt._impl.util as util
|
22
|
+
import tracdap.rt._impl.exec.actors as actors
|
23
|
+
import tracdap.rt._impl.grpc.codec as codec
|
24
|
+
import tracdap.rt._impl.core.logging as logging
|
25
|
+
import tracdap.rt._impl.core.util as util
|
26
26
|
|
27
27
|
# Check whether gRPC is installed before trying to load any of the generated modules
|
28
28
|
try:
|
@@ -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")
|
@@ -29,16 +29,16 @@ import tracdap.rt.api as _api
|
|
29
29
|
import tracdap.rt.config as _cfg
|
30
30
|
import tracdap.rt.exceptions as _ex
|
31
31
|
import tracdap.rt.ext.plugins as _plugins
|
32
|
-
import tracdap.rt.
|
33
|
-
import tracdap.rt.
|
34
|
-
import tracdap.rt.
|
35
|
-
import tracdap.rt._impl.
|
36
|
-
import tracdap.rt._impl.
|
37
|
-
import tracdap.rt._impl.
|
38
|
-
import tracdap.rt._impl.
|
39
|
-
import tracdap.rt._impl.
|
40
|
-
import tracdap.rt._impl.
|
41
|
-
import tracdap.rt._impl.
|
32
|
+
import tracdap.rt._impl.core.config_parser as _cparse
|
33
|
+
import tracdap.rt._impl.core.guard_rails as _guard
|
34
|
+
import tracdap.rt._impl.core.logging as _logging
|
35
|
+
import tracdap.rt._impl.core.models as _models
|
36
|
+
import tracdap.rt._impl.core.storage as _storage
|
37
|
+
import tracdap.rt._impl.core.util as _util
|
38
|
+
import tracdap.rt._impl.exec.actors as _actors
|
39
|
+
import tracdap.rt._impl.exec.engine as _engine
|
40
|
+
import tracdap.rt._impl.exec.dev_mode as _dev_mode
|
41
|
+
import tracdap.rt._impl.static_api as _static_api
|
42
42
|
import tracdap.rt._version as _version
|
43
43
|
|
44
44
|
|
@@ -84,8 +84,8 @@ class TracRuntime:
|
|
84
84
|
if isinstance(scratch_dir, str):
|
85
85
|
scratch_dir = pathlib.Path(scratch_dir)
|
86
86
|
|
87
|
-
|
88
|
-
self._log =
|
87
|
+
_logging.configure_logging()
|
88
|
+
self._log = _logging.logger_for_object(self)
|
89
89
|
self._log.info(f"TRAC D.A.P. Python Runtime {trac_version}")
|
90
90
|
|
91
91
|
self._sys_config = sys_config if isinstance(sys_config, _cfg.RuntimeConfig) else None
|
@@ -229,7 +229,7 @@ class TracRuntime:
|
|
229
229
|
self._log.info("Starting the runtime API server...")
|
230
230
|
|
231
231
|
# The server module pulls in all the gRPC dependencies, don't import it unless we have to
|
232
|
-
import tracdap.rt.
|
232
|
+
import tracdap.rt._impl.grpc.server as _server
|
233
233
|
|
234
234
|
self._server = _server.RuntimeApiServer(self._system, self._server_port)
|
235
235
|
self._server.start()
|
tracdap/rt/_impl/static_api.py
CHANGED
@@ -19,10 +19,11 @@ import types as _ts
|
|
19
19
|
import tracdap.rt.api.experimental as _api
|
20
20
|
import tracdap.rt.metadata as _meta
|
21
21
|
import tracdap.rt.exceptions as _ex
|
22
|
-
import tracdap.rt._impl.data as _data
|
23
|
-
import tracdap.rt._impl.schemas as _schemas
|
24
|
-
import tracdap.rt._impl.
|
25
|
-
import tracdap.rt._impl.
|
22
|
+
import tracdap.rt._impl.core.data as _data
|
23
|
+
import tracdap.rt._impl.core.schemas as _schemas
|
24
|
+
import tracdap.rt._impl.core.struct as _struct
|
25
|
+
import tracdap.rt._impl.core.type_system as _type_system
|
26
|
+
import tracdap.rt._impl.core.validation as _val
|
26
27
|
|
27
28
|
# Import hook interfaces into this module namespace
|
28
29
|
from tracdap.rt.api.hook import _StaticApiHook # noqa
|
@@ -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) \
|
@@ -30,7 +30,7 @@ from tracdap.rt._impl.ext.sql import * # noqa
|
|
30
30
|
import tracdap.rt._plugins._helpers as _helpers
|
31
31
|
|
32
32
|
# TODO: Remove internal references
|
33
|
-
import tracdap.rt._impl.data as _data
|
33
|
+
import tracdap.rt._impl.core.data as _data
|
34
34
|
|
35
35
|
|
36
36
|
class SqlDataStorage(IDataStorageBase[pa.Table, pa.Schema]):
|
@@ -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