mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-04 15:18:17 +00:00
import on call (#2382)
This commit is contained in:
parent
71e78ab460
commit
6a8fc9e0fb
@ -18,9 +18,7 @@ from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
import boto3
|
||||
import click
|
||||
from boto3.exceptions import S3UploadFailedError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.INFO)
|
||||
@ -61,6 +59,16 @@ def upload_backup(endpoint: str, bucket: str, key: str, file: Path) -> None:
|
||||
:param file: file to upload
|
||||
"""
|
||||
|
||||
try:
|
||||
import boto3
|
||||
from boto3.exceptions import S3UploadFailedError
|
||||
except ModuleNotFoundError as err:
|
||||
logger.error(
|
||||
"Trying to import boto3 to run the backup upload."
|
||||
+ " Please install openmetadata-ingestion[backup]."
|
||||
)
|
||||
raise err
|
||||
|
||||
s3_key = Path(key) / file.name
|
||||
click.secho(
|
||||
f"Uploading {file} to {endpoint}/{bucket}/{str(s3_key)}...",
|
||||
|
Loading…
x
Reference in New Issue
Block a user