-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathitems.py
More file actions
37 lines (29 loc) · 1018 Bytes
/
items.py
File metadata and controls
37 lines (29 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from typing import Any, Generator
import pyarrow as pa
from cloudquery.sdk.scheduler import TableResolver
from cloudquery.sdk.schema import Column
from cloudquery.sdk.schema import Table
from cloudquery.sdk.schema.resource import Resource
from plugin.client import Client
class Items(Table):
def __init__(self) -> None:
super().__init__(
name="example_item",
title="Example Item",
columns=[
Column("num", pa.uint64(), primary_key=True),
Column("string", pa.string()),
Column("date", pa.date64()),
],
)
@property
def resolver(self):
return ItemResolver(table=self)
class ItemResolver(TableResolver):
def __init__(self, table) -> None:
super().__init__(table=table)
def resolve(
self, client: Client, parent_resource: Resource
) -> Generator[Any, None, None]:
for item_response in client.client.item_iterator():
yield item_response