Skip to content

Commit

Permalink
Replace deprecated AirbyteLogger with logging.Logger - destination-fi…
Browse files Browse the repository at this point in the history
…rebolt (#40578)
  • Loading branch information
btkcodedev committed Jun 27, 2024
1 parent 661876f commit 3a099af
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#

import json
import logging
from datetime import datetime
from logging import getLogger
from typing import Any, Dict, Iterable, Mapping, Optional
from uuid import uuid4

from airbyte_cdk import AirbyteLogger
from airbyte_cdk.destinations import Destination
from airbyte_cdk.models import AirbyteConnectionStatus, AirbyteMessage, ConfiguredAirbyteCatalog, DestinationSyncMode, Status, Type
from firebolt.client import DEFAULT_API_URL
Expand All @@ -31,11 +31,11 @@ def _determine_auth(key: str, secret: str) -> Auth:
return ClientCredentials(key, secret)


def parse_config(config: json, logger: Optional[AirbyteLogger] = None) -> Dict[str, Any]:
def parse_config(config: json, logger: Optional[logging.Logger] = None) -> Dict[str, Any]:
"""
Convert dict of config values to firebolt.db.Connection arguments
:param config: json-compatible dict of settings
:param logger: AirbyteLogger instance to print logs.
:param logger: logging.Logger instance to print logs.
:return: dictionary of firebolt.db.Connection-compatible kwargs
"""
# We should use client_id/client_secret, this code supports username/password for legacy users
Expand All @@ -58,11 +58,11 @@ def parse_config(config: json, logger: Optional[AirbyteLogger] = None) -> Dict[s
return connection_args


def establish_connection(config: json, logger: Optional[AirbyteLogger] = None) -> Connection:
def establish_connection(config: json, logger: Optional[logging.Logger] = None) -> Connection:
"""
Creates a connection to Firebolt database using the parameters provided.
:param config: Json object containing db credentials.
:param logger: AirbyteLogger instance to print logs.
:param logger: logging.Logger instance to print logs.
:return: PEP-249 compliant database Connection object.
"""
logger.debug("Connecting to Firebolt.") if logger else None
Expand Down Expand Up @@ -116,7 +116,7 @@ def write(
# Flush any leftover messages
writer.flush()

def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConnectionStatus:
def check(self, logger: logging.Logger, config: Mapping[str, Any]) -> AirbyteConnectionStatus:
"""
Tests if the input configuration can be used to successfully connect to the destination with the needed permissions
e.g: if a provided API token or password can be used to connect and write to the destination.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
#

import json
import logging
from collections import defaultdict
from datetime import datetime
from time import time
from uuid import uuid4

import pyarrow as pa
import pyarrow.parquet as pq
from airbyte_cdk import AirbyteLogger
from firebolt.db import Connection
from pyarrow import fs

Expand Down Expand Up @@ -219,7 +219,7 @@ def flush(self) -> None:
self._flush()


def create_firebolt_wirter(connection: Connection, config: json, logger: AirbyteLogger) -> FireboltWriter:
def create_firebolt_wirter(connection: Connection, config: json, logger: logging.Logger) -> FireboltWriter:
if config["loading_method"]["method"] == "S3":
logger.info("Using the S3 writing strategy")
writer = FireboltS3Writer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: database
connectorType: destination
definitionId: 18081484-02a5-4662-8dba-b270b582f321
dockerImageTag: 0.2.3
dockerImageTag: 0.2.4
dockerRepository: airbyte/destination-firebolt
githubIssueLabel: destination-firebolt
connectorBuildOptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "0.2.3"
version = "0.2.4"
name = "destination-firebolt"
description = "Destination implementation for Firebolt."
authors = [ "Airbyte <evan@airbyte.io>",]
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/destinations/firebolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Firebolt. Each table will contain 3 columns:

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :------------------------------------- |
| 0.2.4 | 2024-06-27 | [40578](https://github.com/airbytehq/airbyte/pull/40578) | Replaced deprecated AirbyteLogger with logging.Logger |
| 0.2.3 | 2024-06-25 | [40494](https://github.com/airbytehq/airbyte/pull/40494) | Update dependencies |
| 0.2.2 | 2024-06-22 | [40078](https://github.com/airbytehq/airbyte/pull/40078) | Update dependencies |
| 0.2.1 | 2024-06-06 | [39157](https://github.com/airbytehq/airbyte/pull/39157) | [autopull] Upgrade base image to v1.2.2 |
Expand Down

0 comments on commit 3a099af

Please sign in to comment.