Skip to content

Commit 327e010

Browse files
marcosmarxmptiurinoctavia-squidington-iii
authored
Marcos/destination firebolt up sdk (#38060)
Co-authored-by: ptiurin <[email protected]> Co-authored-by: Petro Tiurin <[email protected]> Co-authored-by: Octavia Squidington III <[email protected]>
1 parent 7309360 commit 327e010

File tree

12 files changed

+3294
-86
lines changed

12 files changed

+3294
-86
lines changed

airbyte-integrations/connectors/destination-firebolt/Dockerfile

-29
This file was deleted.

airbyte-integrations/connectors/destination-firebolt/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For information about how to use this connector within Airbyte, see [the documen
99

1010
**To iterate on this connector, make sure to complete this prerequisites section.**
1111

12-
#### Minimum Python version required `= 3.7.0`
12+
#### Minimum Python version required `= 3.8.0`
1313

1414
#### Build & Activate Virtual Environment and install dependencies
1515

airbyte-integrations/connectors/destination-firebolt/destination_firebolt/destination.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,37 @@
1212
from airbyte_cdk.destinations import Destination
1313
from airbyte_cdk.models import AirbyteConnectionStatus, AirbyteMessage, ConfiguredAirbyteCatalog, DestinationSyncMode, Status, Type
1414
from firebolt.client import DEFAULT_API_URL
15-
from firebolt.client.auth import UsernamePassword
15+
from firebolt.client.auth import Auth, ClientCredentials, UsernamePassword
1616
from firebolt.db import Connection, connect
1717

1818
from .writer import create_firebolt_wirter
1919

2020
logger = getLogger("airbyte")
2121

2222

23+
def _determine_auth(key: str, secret: str) -> Auth:
24+
"""
25+
Determine between new auth based on key and secret or legacy email based auth.
26+
"""
27+
if "@" in key:
28+
# email auth can only be used with UsernamePassword
29+
return UsernamePassword(key, secret)
30+
else:
31+
return ClientCredentials(key, secret)
32+
33+
2334
def parse_config(config: json, logger: Optional[AirbyteLogger] = None) -> Dict[str, Any]:
2435
"""
2536
Convert dict of config values to firebolt.db.Connection arguments
2637
:param config: json-compatible dict of settings
2738
:param logger: AirbyteLogger instance to print logs.
2839
:return: dictionary of firebolt.db.Connection-compatible kwargs
2940
"""
41+
# We should use client_id/client_secret, this code supports username/password for legacy users
42+
auth = _determine_auth(config.get("client_id", config.get("username")), config.get("client_secret", config.get("password")))
3043
connection_args = {
3144
"database": config["database"],
32-
"auth": UsernamePassword(config["username"], config["password"]),
45+
"auth": auth,
3346
"api_endpoint": config.get("host", DEFAULT_API_URL),
3447
"account_name": config.get("account"),
3548
}

airbyte-integrations/connectors/destination-firebolt/destination_firebolt/spec.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
"$schema": "http://json-schema.org/draft-07/schema#",
99
"title": "Firebolt Spec",
1010
"type": "object",
11-
"required": ["username", "password", "database"],
11+
"required": ["client_id", "client_secret", "account", "database", "engine"],
1212
"additionalProperties": false,
1313
"properties": {
14-
"username": {
14+
"client_id": {
1515
"type": "string",
16-
"title": "Username",
17-
"description": "Firebolt email address you use to login.",
18-
"examples": ["[email protected]"],
16+
"title": "Client ID",
17+
"description": "Firebolt service account ID.",
18+
"examples": ["bbl9qth066hmxkwyb0hy2iwk8ktez9dz"],
1919
"order": 0
2020
},
21-
"password": {
21+
"client_secret": {
2222
"type": "string",
23-
"title": "Password",
24-
"description": "Firebolt password.",
23+
"title": "Client Secret",
24+
"description": "Firebolt secret, corresponding to the service account ID.",
2525
"airbyte_secret": true,
2626
"order": 1
2727
},
@@ -44,7 +44,7 @@
4444
"engine": {
4545
"type": "string",
4646
"title": "Engine",
47-
"description": "Engine name or url to connect to."
47+
"description": "Engine name to connect to."
4848
},
4949
"loading_method": {
5050
"type": "object",

airbyte-integrations/connectors/destination-firebolt/metadata.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ data:
22
connectorSubtype: database
33
connectorType: destination
44
definitionId: 18081484-02a5-4662-8dba-b270b582f321
5-
dockerImageTag: 0.1.1
5+
dockerImageTag: 0.2.0
66
dockerRepository: airbyte/destination-firebolt
77
githubIssueLabel: destination-firebolt
8+
connectorBuildOptions:
9+
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
810
icon: firebolt.svg
911
license: MIT
1012
name: Firebolt

0 commit comments

Comments
 (0)