airbyte-source-google-drive 0.3.2__tar.gz → 0.4.3.dev202504071123__tar.gz
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.
Potentially problematic release.
This version of airbyte-source-google-drive might be problematic. Click here for more details.
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/PKG-INFO +2 -2
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/pyproject.toml +5 -2
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/stream_reader.py +27 -10
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/README.md +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/__init__.py +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/exceptions.py +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/run.py +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/schemas/file_permissions.json +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/schemas/identities.json +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/source.py +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/spec.py +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/stream_permissions_reader.py +0 -0
- {airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/source_google_drive/utils.py +0 -0
{airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: airbyte-source-google-drive
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.4.3.dev202504071123
|
|
4
4
|
Summary: Source implementation for Google Drive.
|
|
5
5
|
License: ELv2
|
|
6
6
|
Author: Airbyte
|
|
@@ -10,7 +10,7 @@ Classifier: License :: Other/Proprietary License
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Requires-Dist: airbyte-cdk[file-based] (
|
|
13
|
+
Requires-Dist: airbyte-cdk[file-based] (==6.45.0.dev04101)
|
|
14
14
|
Requires-Dist: google-api-python-client (==2.104.0)
|
|
15
15
|
Requires-Dist: google-api-python-client-stubs (==1.18.0)
|
|
16
16
|
Requires-Dist: google-auth-httplib2 (==0.1.1)
|
|
@@ -5,7 +5,7 @@ requires = [
|
|
|
5
5
|
build-backend = "poetry.core.masonry.api"
|
|
6
6
|
|
|
7
7
|
[tool.poetry]
|
|
8
|
-
version = "0.3.
|
|
8
|
+
version = "0.4.3.dev202504071123"
|
|
9
9
|
name = "airbyte-source-google-drive"
|
|
10
10
|
description = "Source implementation for Google Drive."
|
|
11
11
|
authors = [
|
|
@@ -19,6 +19,9 @@ repository = "https://github.com/airbytehq/airbyte"
|
|
|
19
19
|
packages = [
|
|
20
20
|
{ include = "source_google_drive" },
|
|
21
21
|
]
|
|
22
|
+
source = [
|
|
23
|
+
{ name = "testpypi", url = "https://test.pypi.org/simple/", priority = "supplemental" },
|
|
24
|
+
]
|
|
22
25
|
|
|
23
26
|
[tool.poetry.dependencies]
|
|
24
27
|
python = "^3.10,<3.12"
|
|
@@ -31,7 +34,7 @@ google-api-python-client-stubs = "==1.18.0"
|
|
|
31
34
|
extras = [
|
|
32
35
|
"file-based",
|
|
33
36
|
]
|
|
34
|
-
version = "
|
|
37
|
+
version = "6.45.0.dev04101"
|
|
35
38
|
|
|
36
39
|
[tool.poetry.scripts]
|
|
37
40
|
source-google-drive = "source_google_drive.run:run"
|
|
@@ -6,27 +6,26 @@
|
|
|
6
6
|
import io
|
|
7
7
|
import json
|
|
8
8
|
import logging
|
|
9
|
-
import
|
|
9
|
+
import os
|
|
10
10
|
from datetime import datetime
|
|
11
11
|
from io import IOBase
|
|
12
12
|
from os.path import getsize
|
|
13
|
-
from typing import
|
|
13
|
+
from typing import Dict, Iterable, List, Optional, Set, Tuple
|
|
14
14
|
|
|
15
|
-
import pytz
|
|
16
15
|
from google.oauth2 import credentials, service_account
|
|
17
16
|
from googleapiclient.discovery import build
|
|
18
17
|
from googleapiclient.http import MediaIoBaseDownload
|
|
19
18
|
|
|
20
19
|
from airbyte_cdk import AirbyteTracedException, FailureType
|
|
20
|
+
from airbyte_cdk.models import AirbyteRecordMessageFileReference
|
|
21
21
|
from airbyte_cdk.sources.file_based.exceptions import FileSizeLimitError
|
|
22
22
|
from airbyte_cdk.sources.file_based.file_based_stream_reader import AbstractFileBasedStreamReader, FileReadMode
|
|
23
|
+
from airbyte_cdk.sources.file_based.file_record_data import FileRecordData
|
|
23
24
|
from airbyte_cdk.sources.file_based.remote_file import RemoteFile
|
|
24
|
-
from airbyte_cdk.sources.streams.core import package_name_from_class
|
|
25
|
-
from airbyte_cdk.sources.utils.schema_helpers import InternalConfig, ResourceSchemaLoader
|
|
26
25
|
from source_google_drive.utils import get_folder_id
|
|
27
26
|
|
|
28
27
|
from .exceptions import ErrorDownloadingFile, ErrorFetchingMetadata
|
|
29
|
-
from .spec import
|
|
28
|
+
from .spec import SourceGoogleDriveSpec
|
|
30
29
|
|
|
31
30
|
|
|
32
31
|
FOLDER_MIME_TYPE = "application/vnd.google-apps.folder"
|
|
@@ -245,7 +244,9 @@ class SourceGoogleDriveStreamReader(AbstractFileBasedStreamReader):
|
|
|
245
244
|
except Exception as e:
|
|
246
245
|
raise ErrorFetchingMetadata(f"An error occurred while retrieving file size: {str(e)}")
|
|
247
246
|
|
|
248
|
-
def
|
|
247
|
+
def upload(
|
|
248
|
+
self, file: GoogleDriveRemoteFile, local_directory: str, logger: logging.Logger
|
|
249
|
+
) -> Tuple[FileRecordData, AirbyteRecordMessageFileReference]:
|
|
249
250
|
"""
|
|
250
251
|
Downloads a file from Google Drive to a specified local directory.
|
|
251
252
|
|
|
@@ -265,15 +266,18 @@ class SourceGoogleDriveStreamReader(AbstractFileBasedStreamReader):
|
|
|
265
266
|
raise FileSizeLimitError(message=message, internal_message=message, failure_type=FailureType.config_error)
|
|
266
267
|
|
|
267
268
|
try:
|
|
268
|
-
|
|
269
|
+
file_paths = self._get_file_transfer_paths(file, local_directory)
|
|
270
|
+
local_file_path = file_paths[self.LOCAL_FILE_PATH]
|
|
271
|
+
file_relative_path = file_paths[self.FILE_RELATIVE_PATH]
|
|
272
|
+
file_name = file_paths[self.FILE_NAME]
|
|
269
273
|
|
|
270
274
|
if self._is_exportable_document(file.original_mime_type):
|
|
271
275
|
request = self.google_drive_service.files().export_media(fileId=file.id, mimeType=file.mime_type)
|
|
272
276
|
|
|
273
277
|
file_extension = DOWNLOADABLE_DOCUMENTS_MIME_TYPES[file.original_mime_type][DOCUMENT_FILE_EXTENSION_KEY]
|
|
274
278
|
local_file_path += file_extension
|
|
275
|
-
absolute_file_path += file_extension
|
|
276
279
|
file_relative_path += file_extension
|
|
280
|
+
file_name += file_extension
|
|
277
281
|
else:
|
|
278
282
|
request = self.google_drive_service.files().get_media(fileId=file.id)
|
|
279
283
|
|
|
@@ -288,7 +292,20 @@ class SourceGoogleDriveStreamReader(AbstractFileBasedStreamReader):
|
|
|
288
292
|
# native google objects seems to be reporting lower size through the api than the final download size
|
|
289
293
|
file_size = getsize(local_file_path)
|
|
290
294
|
|
|
291
|
-
|
|
295
|
+
file_record_data = FileRecordData(
|
|
296
|
+
folder=file_paths[self.FILE_FOLDER],
|
|
297
|
+
filename=file_name,
|
|
298
|
+
bytes=file_size,
|
|
299
|
+
id=file.id,
|
|
300
|
+
mime_type=file.mime_type,
|
|
301
|
+
updated_at=int(file.last_modified.timestamp() * 1000),
|
|
302
|
+
)
|
|
303
|
+
file_reference = AirbyteRecordMessageFileReference(
|
|
304
|
+
staging_file_url=local_file_path,
|
|
305
|
+
source_file_relative_path=file_relative_path,
|
|
306
|
+
file_size_bytes=file_size,
|
|
307
|
+
)
|
|
308
|
+
return file_record_data, file_reference
|
|
292
309
|
|
|
293
310
|
except Exception as e:
|
|
294
311
|
raise ErrorDownloadingFile(f"There was an error while trying to download the file {file.uri}: {str(e)}")
|
{airbyte_source_google_drive-0.3.2 → airbyte_source_google_drive-0.4.3.dev202504071123}/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|