Skip to content

Commit 7927d1a

Browse files
authored
fix: Fix JSON and UUID type checking, add JSON test, consolidate setup.py (#14)
* Fix JSON and UUID type checking, add JSON test, consolidate setup.py and requirements.txt
1 parent c61a774 commit 7927d1a

File tree

6 files changed

+37
-35
lines changed

6 files changed

+37
-35
lines changed

cloudquery/sdk/scalar/scalar_factory.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import pyarrow as pa
2-
from .scalar import ScalarInvalidTypeError
2+
3+
from cloudquery.sdk.types import UUIDType, JSONType
34
from .binary import Binary
45
from .bool import Bool
56
from .date32 import Date32
67
from .date64 import Date64
78
from .float import Float
89
from .int import Int
910
from .list import List
11+
from .scalar import ScalarInvalidTypeError
1012
from .string import String
1113
from .timestamp import Timestamp
1214
from .uint import Uint
1315
from .uuid import UUID
14-
from cloudquery.sdk.types import UUIDType, JSONType
1516

1617

1718
class ScalarFactory:
@@ -85,9 +86,9 @@ def new_scalar(self, dt: pa.DataType):
8586
# return ()
8687
elif dt_id == pa.types.lib.Type_TIMESTAMP:
8788
return Timestamp()
88-
elif dt == UUIDType:
89+
elif dt == UUIDType():
8990
return UUID()
90-
elif dt == JSONType:
91+
elif dt == JSONType():
9192
return String()
9293
else:
9394
raise ScalarInvalidTypeError("Invalid type {} for scalar".format(dt))

cloudquery/sdk/scheduler/scheduler.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
from typing import List, Generator, Any
21
import queue
3-
import time
2+
from concurrent import futures
3+
from typing import List, Generator, Any
4+
45
import structlog
5-
from enum import Enum
6-
from cloudquery.sdk.schema import Table, Resource
6+
77
from cloudquery.sdk.message import (
88
SyncMessage,
99
SyncInsertMessage,
1010
SyncMigrateTableMessage,
1111
)
12-
from concurrent import futures
13-
from typing import Generator
12+
from cloudquery.sdk.schema import Resource
1413
from .table_resolver import TableResolver
15-
import traceback
1614

1715
QUEUE_PER_WORKER = 100
1816

@@ -192,4 +190,4 @@ def sync(
192190
break
193191
continue
194192
yield message
195-
thread.shutdown()
193+
thread.shutdown(wait=True)

requirements.txt

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
1-
cloudquery-plugin-pb==0.0.14
2-
exceptiongroup==1.1.2
3-
black==23.7.0
4-
grpcio==1.56.2
5-
grpcio-tools==1.56.2
6-
iniconfig==2.0.0
7-
Jinja2==3.1.2
8-
MarkupSafe==2.1.3
9-
numpy==1.25.2
10-
packaging==23.1
11-
pandas==2.0.3
12-
pluggy==1.2.0
13-
protobuf==4.23.4
14-
pyarrow==12.0.1
15-
pytest==7.4.0
16-
python-dateutil==2.8.2
17-
pytz==2023.3
18-
six==1.16.0
19-
structlog==23.1.0
20-
tomli==2.0.1
21-
tzdata==2023.3
1+
.

setup.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,26 @@
1111

1212
dependencies = [
1313
"cloudquery-plugin-pb==0.0.14",
14-
"pyarrow==12.0.1",
14+
"exceptiongroup==1.1.2",
15+
"black==23.7.0",
16+
"grpcio==1.56.2",
17+
"grpcio-tools==1.56.2",
18+
"iniconfig==2.0.0",
1519
"Jinja2==3.1.2",
16-
"structlog==23.1.0",
20+
"MarkupSafe==2.1.3",
21+
"numpy==1.25.2",
22+
"packaging==23.1",
1723
"pandas==2.0.3",
24+
"pluggy==1.2.0",
25+
"protobuf==4.23.4",
26+
"pyarrow==12.0.1",
27+
"pytest==7.4.0",
28+
"python-dateutil==2.8.2",
29+
"pytz==2023.3",
30+
"six==1.16.0",
31+
"structlog==23.1.0",
32+
"tomli==2.0.1",
33+
"tzdata==2023.3",
1834
]
1935
url = "https://github.com/cloudquery/plugin-sdk-python"
2036

tests/types/__init__.py

Whitespace-only changes.

tests/types/json.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from cloudquery.sdk.types import JSONType
2+
3+
4+
def test_json_type():
5+
j = JSONType()
6+
# test equality
7+
assert j == JSONType()

0 commit comments

Comments
 (0)