airbyte-source-google-sheets 0.5.6__py3-none-any.whl → 0.5.9__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.
- {airbyte_source_google_sheets-0.5.6.dist-info → airbyte_source_google_sheets-0.5.9.dist-info}/METADATA +1 -1
- {airbyte_source_google_sheets-0.5.6.dist-info → airbyte_source_google_sheets-0.5.9.dist-info}/RECORD +6 -6
- source_google_sheets/helpers.py +4 -3
- source_google_sheets/source.py +12 -5
- {airbyte_source_google_sheets-0.5.6.dist-info → airbyte_source_google_sheets-0.5.9.dist-info}/WHEEL +0 -0
- {airbyte_source_google_sheets-0.5.6.dist-info → airbyte_source_google_sheets-0.5.9.dist-info}/entry_points.txt +0 -0
{airbyte_source_google_sheets-0.5.6.dist-info → airbyte_source_google_sheets-0.5.9.dist-info}/RECORD
RENAMED
@@ -1,14 +1,14 @@
|
|
1
1
|
source_google_sheets/__init__.py,sha256=-aGVMRfrgWjYad3_cHofIptEEa5WMQzTvFD92HevQfw,73
|
2
2
|
source_google_sheets/client.py,sha256=k7AAS0XbHdKDIywgrRMTpKMcKYQfHOjAi2s-MjDRqQs,2391
|
3
|
-
source_google_sheets/helpers.py,sha256=
|
3
|
+
source_google_sheets/helpers.py,sha256=kKXop3YyQ3jPYlWgWW3GmRPxDmnuoHZ4joa3rQLCxUQ,10642
|
4
4
|
source_google_sheets/models/__init__.py,sha256=Z-4MTpxG5t2jGhXzs4PPoIOa83zw3jRnUDx0N9Puv3s,61
|
5
5
|
source_google_sheets/models/spreadsheet.py,sha256=ebGZ39_QKT6Lrf7Hblo3pdjswFhoEzF8vno2TmEMyUU,1109
|
6
6
|
source_google_sheets/models/spreadsheet_values.py,sha256=OFbSvgeo5LnfMy6BURtDvWfRsJn7GN2AYMVkNQNkE-o,437
|
7
7
|
source_google_sheets/run.py,sha256=_f5-LNqMzBuHtCD1YoUBxnA0fszgqmdNGcN7y_AmXU0,237
|
8
|
-
source_google_sheets/source.py,sha256=
|
8
|
+
source_google_sheets/source.py,sha256=GbBxrW40DPIEFEzI_3jvRUS_1vYMqKAcAYA43oXRLJ8,13049
|
9
9
|
source_google_sheets/spec.yaml,sha256=WrPdH2xLCdyM-kY-pRqbwICcNPhv8nqnb2gdbslTsaQ,5141
|
10
10
|
source_google_sheets/utils.py,sha256=ZB5lboyffiuuQdSarqe8AqBGEyiQpxiOfxqcU7Ght8A,2289
|
11
|
-
airbyte_source_google_sheets-0.5.
|
12
|
-
airbyte_source_google_sheets-0.5.
|
13
|
-
airbyte_source_google_sheets-0.5.
|
14
|
-
airbyte_source_google_sheets-0.5.
|
11
|
+
airbyte_source_google_sheets-0.5.9.dist-info/METADATA,sha256=m2pnwVstyOH0NGKYxzKwY6z1KsDXVSn57oQsNj3yOTo,5537
|
12
|
+
airbyte_source_google_sheets-0.5.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
13
|
+
airbyte_source_google_sheets-0.5.9.dist-info/entry_points.txt,sha256=Dtsfjohe5IPUFyqojk49SIoP7CifCTlNLG_pgivzppo,69
|
14
|
+
airbyte_source_google_sheets-0.5.9.dist-info/RECORD,,
|
source_google_sheets/helpers.py
CHANGED
@@ -9,7 +9,6 @@ from collections import defaultdict
|
|
9
9
|
from datetime import datetime
|
10
10
|
from typing import Dict, FrozenSet, Iterable, List, Tuple
|
11
11
|
|
12
|
-
from airbyte_cdk.logger import AirbyteLogger
|
13
12
|
from airbyte_cdk.models.airbyte_protocol import AirbyteRecordMessage, AirbyteStream, ConfiguredAirbyteCatalog, SyncMode
|
14
13
|
from google.oauth2 import credentials as client_account
|
15
14
|
from google.oauth2 import service_account
|
@@ -43,7 +42,7 @@ class Helpers(object):
|
|
43
42
|
return client_account.Credentials.from_authorized_user_info(info=credentials)
|
44
43
|
|
45
44
|
@staticmethod
|
46
|
-
def headers_to_airbyte_stream(logger:
|
45
|
+
def headers_to_airbyte_stream(logger: logging.Logger, sheet_name: str, header_row_values: List[str]) -> AirbyteStream:
|
47
46
|
"""
|
48
47
|
Parses sheet headers from the provided row. This method assumes that data is contiguous
|
49
48
|
i.e: every cell contains a value and the first cell which does not contain a value denotes the end
|
@@ -194,7 +193,9 @@ class Helpers(object):
|
|
194
193
|
non_grid_sheets.append(sheet_title)
|
195
194
|
|
196
195
|
if non_grid_sheets:
|
197
|
-
|
196
|
+
# logging.getLogger(...).log() expects an integer level. The level for WARN is 30
|
197
|
+
# Reference: https://docs.python.org/3.10/library/logging.html#levels
|
198
|
+
logging.getLogger("airbyte").log(30, "Skip non-grid sheets: " + ", ".join(non_grid_sheets))
|
198
199
|
|
199
200
|
return grid_sheets
|
200
201
|
|
source_google_sheets/source.py
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
import json
|
7
|
+
import logging
|
7
8
|
import socket
|
8
9
|
from typing import Any, Generator, List, Mapping, MutableMapping, Optional, Union
|
9
10
|
|
10
|
-
from airbyte_cdk.logger import AirbyteLogger
|
11
11
|
from airbyte_cdk.models import FailureType
|
12
12
|
from airbyte_cdk.models.airbyte_protocol import (
|
13
13
|
AirbyteCatalog,
|
@@ -45,7 +45,7 @@ class SourceGoogleSheets(Source):
|
|
45
45
|
Spreadsheets API Reference: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets
|
46
46
|
"""
|
47
47
|
|
48
|
-
def check(self, logger:
|
48
|
+
def check(self, logger: logging.Logger, config: json) -> AirbyteConnectionStatus:
|
49
49
|
# Check involves verifying that the specified spreadsheet is reachable with our credentials.
|
50
50
|
try:
|
51
51
|
client = GoogleSheetsClient(self.get_credentials(config))
|
@@ -110,7 +110,7 @@ class SourceGoogleSheets(Source):
|
|
110
110
|
|
111
111
|
return AirbyteConnectionStatus(status=Status.SUCCEEDED)
|
112
112
|
|
113
|
-
def discover(self, logger:
|
113
|
+
def discover(self, logger: logging.Logger, config: json) -> AirbyteCatalog:
|
114
114
|
client = GoogleSheetsClient(self.get_credentials(config))
|
115
115
|
spreadsheet_id = Helpers.get_spreadsheet_id(config["spreadsheet_id"])
|
116
116
|
try:
|
@@ -143,10 +143,17 @@ class SourceGoogleSheets(Source):
|
|
143
143
|
failure_type=FailureType.config_error,
|
144
144
|
) from err
|
145
145
|
raise Exception(f"Could not discover the schema of your spreadsheet. {error_description}. {err.reason}.")
|
146
|
+
except google_exceptions.GoogleAuthError as err:
|
147
|
+
message = "Access to the spreadsheet expired or was revoked. Re-authenticate to restore access."
|
148
|
+
raise AirbyteTracedException(
|
149
|
+
message=message,
|
150
|
+
internal_message=message,
|
151
|
+
failure_type=FailureType.config_error,
|
152
|
+
) from err
|
146
153
|
|
147
154
|
def _read(
|
148
155
|
self,
|
149
|
-
logger:
|
156
|
+
logger: logging.Logger,
|
150
157
|
config: json,
|
151
158
|
catalog: ConfiguredAirbyteCatalog,
|
152
159
|
state: Union[List[AirbyteStateMessage], MutableMapping[str, Any]] = None,
|
@@ -227,7 +234,7 @@ class SourceGoogleSheets(Source):
|
|
227
234
|
|
228
235
|
def read(
|
229
236
|
self,
|
230
|
-
logger:
|
237
|
+
logger: logging.Logger,
|
231
238
|
config: json,
|
232
239
|
catalog: ConfiguredAirbyteCatalog,
|
233
240
|
state: Union[List[AirbyteStateMessage], MutableMapping[str, Any]] = None,
|
{airbyte_source_google_sheets-0.5.6.dist-info → airbyte_source_google_sheets-0.5.9.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|