]>
git.immae.eu Git - github/fretlink/tap-google-sheets.git/blob - tap_google_sheets/discover.py
1 from singer
.catalog
import Catalog
, CatalogEntry
, Schema
2 from tap_google_sheets
.schema
import get_schemas
, STREAMS
5 def discover(client
, spreadsheet_id
):
6 schemas
, field_metadata
= get_schemas(client
, spreadsheet_id
)
9 for stream_name
, schema_dict
in schemas
.items():
10 schema
= Schema
.from_dict(schema_dict
)
11 mdata
= field_metadata
[stream_name
]
14 table_key_properties
= md
.get('metadata', {}).get('table-key-properties')
15 if table_key_properties
:
16 key_properties
= table_key_properties
18 catalog
.streams
.append(CatalogEntry(
20 tap_stream_id
=stream_name
,
21 key_properties
=STREAMS
.get(stream_name
, {}).get('key_properties', key_properties
),