cloudquery-plugin-sdk 0.1.23__py2.py3-none-any.whl → 0.1.24__py2.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.
@@ -1,14 +1,22 @@
1
+ import json
2
+
1
3
  from cloudquery.sdk import plugin
2
4
  from cloudquery.sdk import message
3
5
  from cloudquery.sdk import schema
4
6
  from typing import List, Generator, Dict
5
7
  import pyarrow as pa
6
8
  from cloudquery.sdk.types import JSONType
9
+ from dataclasses import dataclass, field
7
10
 
8
11
  NAME = "memdb"
9
12
  VERSION = "development"
10
13
 
11
14
 
15
+ @dataclass
16
+ class Spec:
17
+ abc: str = field(default="abc")
18
+
19
+
12
20
  class MemDB(plugin.Plugin):
13
21
  def __init__(self) -> None:
14
22
  super().__init__(
@@ -73,6 +81,12 @@ class MemDB(plugin.Plugin):
73
81
  ),
74
82
  }
75
83
 
84
+ def init(self, spec, no_connection: bool = False):
85
+ if no_connection:
86
+ return
87
+ self._spec_json = json.loads(spec)
88
+ self._spec = Spec(**self._spec_json)
89
+
76
90
  def get_tables(self, options: plugin.TableOptions = None) -> List[plugin.Table]:
77
91
  tables = list(self._tables.values())
78
92
  return schema.filter_dfs(tables, options.tables, options.skip_tables)
@@ -32,7 +32,9 @@ class PluginServicer(plugin_pb2_grpc.PluginServicer):
32
32
  return plugin_pb2.GetSpecSchema.Response(json_schema=self._plugin.json_schema())
33
33
 
34
34
  def Init(self, request: plugin_pb2.Init.Request, context):
35
- self._plugin.init(request.spec, no_connection=request.no_connection)
35
+ self._plugin.init(
36
+ sanitize_spec(request.spec), no_connection=request.no_connection
37
+ )
36
38
  return plugin_pb2.Init.Response()
37
39
 
38
40
  def GetTables(self, request: plugin_pb2.GetTables.Request, context):
@@ -113,3 +115,7 @@ class PluginServicer(plugin_pb2_grpc.PluginServicer):
113
115
  def Close(self, request, context):
114
116
  self._plugin.close()
115
117
  return plugin_pb2.Close.Response()
118
+
119
+
120
+ def sanitize_spec(spec=None):
121
+ return b"{}" if spec is None or spec == b"" or spec == b"null" else spec
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudquery-plugin-sdk
3
- Version: 0.1.23
3
+ Version: 0.1.24
4
4
  Summary: CloudQuery Plugin SDK for Python
5
5
  Home-page: https://github.com/cloudquery/plugin-sdk-python
6
6
  Author: CloudQuery LTD
@@ -1,14 +1,14 @@
1
- cloudquery_plugin_sdk-0.1.23-py3.11-nspkg.pth,sha256=DPwVEJKI3l-PsvgSiQi4zcKjh50W15YbcAr9gUpExc4,487
1
+ cloudquery_plugin_sdk-0.1.24-py3.11-nspkg.pth,sha256=DPwVEJKI3l-PsvgSiQi4zcKjh50W15YbcAr9gUpExc4,487
2
2
  cloudquery/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  cloudquery/sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cloudquery/sdk/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  cloudquery/sdk/internal/memdb/__init__.py,sha256=fzRjFUy47sNj4GzDcxPQPg9MwgSlRJK-XXoOxb40qM8,25
6
- cloudquery/sdk/internal/memdb/memdb.py,sha256=Ad0U3fm3a4PNs9PuvhG0nmQIPK0joQ6wsqdJEAB-vgU,3676
6
+ cloudquery/sdk/internal/memdb/memdb.py,sha256=MMpfKJVwYS5eXqanZh6vqyvgXSg0Vr9MtLbUgkapsxo,3980
7
7
  cloudquery/sdk/internal/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  cloudquery/sdk/internal/servers/discovery_v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  cloudquery/sdk/internal/servers/discovery_v1/discovery.py,sha256=iYQpSw1aSXgKK4zcHxIZSvaA9j-IQfDkeHnVur4sogw,360
10
10
  cloudquery/sdk/internal/servers/plugin_v3/__init__.py,sha256=5sE_Gdw1MnNOTdlHkd3Von1YEIo1s-jvMxSiq9WyRiw,35
11
- cloudquery/sdk/internal/servers/plugin_v3/plugin.py,sha256=tnBeOGzbee8LjxyIMA2uU7GHCAiIscic-HQnheG8uuo,4440
11
+ cloudquery/sdk/internal/servers/plugin_v3/plugin.py,sha256=O9QKcP-_shLEN84rlKJsy7mw78qpSWKUTokMBcRhCb0,4586
12
12
  cloudquery/sdk/message/__init__.py,sha256=KfRu1ZmLz4r-9qgOsXqgAZYetj2_MKjKAJ2HRgARi2w,191
13
13
  cloudquery/sdk/message/sync.py,sha256=O2deyqCbZ84s5DvYgEozN1JMpWmlhXVPUOatM4fjq3w,283
14
14
  cloudquery/sdk/message/write.py,sha256=i30d2nC_YGcGlei0qBd3yHatbJ2C72ZF6QYWURdysYM,545
@@ -46,8 +46,8 @@ cloudquery/sdk/transformers/transformers.py,sha256=9USd5VDEMkyk-RfQboMhr9BwC0593
46
46
  cloudquery/sdk/types/__init__.py,sha256=VRRTI0mHh_TxkNht9qyr3eouNV71jv1v6z9UDFvLPU8,54
47
47
  cloudquery/sdk/types/json.py,sha256=d1EYb8-C74U71IUajHgbetD4wTS7fIsh04qY84mq2-U,653
48
48
  cloudquery/sdk/types/uuid.py,sha256=Xhax4Pyfwd-rxnBSBZLt9k2Mlx2FVCyUOcKWcRiHA0U,677
49
- cloudquery_plugin_sdk-0.1.23.dist-info/METADATA,sha256=rfNYvQTQiTKteS5BY9NYTaYI9ZU-V2MjYnE-kT-gUL0,1825
50
- cloudquery_plugin_sdk-0.1.23.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
51
- cloudquery_plugin_sdk-0.1.23.dist-info/namespace_packages.txt,sha256=D13SSF-LACnBbtgkIVGVOAVT5hqwn2E-v0NGcuyprk4,11
52
- cloudquery_plugin_sdk-0.1.23.dist-info/top_level.txt,sha256=D13SSF-LACnBbtgkIVGVOAVT5hqwn2E-v0NGcuyprk4,11
53
- cloudquery_plugin_sdk-0.1.23.dist-info/RECORD,,
49
+ cloudquery_plugin_sdk-0.1.24.dist-info/METADATA,sha256=-FA5N0cKcN-Qc9LkBKCI6Kh1UBj1ma3JZazpURYP2-4,1825
50
+ cloudquery_plugin_sdk-0.1.24.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
51
+ cloudquery_plugin_sdk-0.1.24.dist-info/namespace_packages.txt,sha256=D13SSF-LACnBbtgkIVGVOAVT5hqwn2E-v0NGcuyprk4,11
52
+ cloudquery_plugin_sdk-0.1.24.dist-info/top_level.txt,sha256=D13SSF-LACnBbtgkIVGVOAVT5hqwn2E-v0NGcuyprk4,11
53
+ cloudquery_plugin_sdk-0.1.24.dist-info/RECORD,,