]>
git.immae.eu Git - github/fretlink/tap-google-sheets.git/blob - tap_google_sheets/streams.py
231a41d0cde60e8915136e7f79bbf44b1454201d
1 from collections
import OrderedDict
3 # streams: API URL endpoints to be called
5 # <root node>: Plural stream name for the endpoint
6 # path: API endpoint relative path, when added to the base URL, creates the full path,
7 # default = stream_name
8 # key_properties: Primary key fields for identifying an endpoint record.
9 # replication_method: INCREMENTAL or FULL_TABLE
10 # replication_keys: bookmark_field(s), typically a date-time, used for filtering the results
11 # and setting the state
12 # params: Query, sort, and other endpoint specific parameters; default = {}
13 # data_key: JSON element containing the results list for the endpoint; default = root (no data_key)
14 # bookmark_query_field: From date-time field used for filtering the query
15 # bookmark_type: Data type for bookmark, integer or datetime
19 "path": "files/{spreadsheet_id}",
20 "key_properties": ["id"],
21 "replication_method": "INCREMENTAL",
22 "replication_keys": ["modifiedTime"],
24 "fields": "id,name,createdTime,modifiedTime,version,teamDriveId,driveId,lastModifyingUser"
28 SPREADSHEET_METADATA
= {
30 "path": "spreadsheets/{spreadsheet_id}",
31 "key_properties": ["spreadsheetId"],
32 "replication_method": "FULL_TABLE",
34 "includeGridData": "false"
40 "path": "spreadsheets/{spreadsheet_id}",
41 "key_properties": ["sheetId"],
42 "replication_method": "FULL_TABLE",
44 "includeGridData": "true",
45 "ranges": "'{sheet_title}'!1:2"
51 "path": "spreadsheets/{spreadsheet_id}/values/'{sheet_title}'!{range_rows}",
53 "key_properties": ["spreadsheetId", "sheetId", "loadDate"],
54 "replication_method": "FULL_TABLE",
56 "dateTimeRenderOption": "SERIAL_NUMBER",
57 "valueRenderOption": "UNFORMATTED_VALUE",
58 "majorDimension": "ROWS"
62 # Ensure streams are ordered logically
63 STREAMS
= OrderedDict()
64 STREAMS
['file_metadata'] = FILE_METADATA
65 STREAMS
['spreadsheet_metadata'] = SPREADSHEET_METADATA
66 STREAMS
['sheet_metadata'] = SHEET_METADATA
67 STREAMS
['sheets_loaded'] = SHEETS_LOADED