Skip to content

Marcos/destination firebolt up sdk #38060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions airbyte-integrations/connectors/destination-firebolt/Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For information about how to use this connector within Airbyte, see [the documen

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

#### Minimum Python version required `= 3.7.0`
#### Minimum Python version required `= 3.8.0`

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,37 @@
from airbyte_cdk.destinations import Destination
from airbyte_cdk.models import AirbyteConnectionStatus, AirbyteMessage, ConfiguredAirbyteCatalog, DestinationSyncMode, Status, Type
from firebolt.client import DEFAULT_API_URL
from firebolt.client.auth import UsernamePassword
from firebolt.client.auth import Auth, ClientCredentials, UsernamePassword
from firebolt.db import Connection, connect

from .writer import create_firebolt_wirter

logger = getLogger("airbyte")


def _determine_auth(key: str, secret: str) -> Auth:
"""
Determine between new auth based on key and secret or legacy email based auth.
"""
if "@" in key:
# email auth can only be used with UsernamePassword
return UsernamePassword(key, secret)
else:
return ClientCredentials(key, secret)


def parse_config(config: json, logger: Optional[AirbyteLogger] = 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.
:return: dictionary of firebolt.db.Connection-compatible kwargs
"""
# We should use client_id/client_secret, this code supports username/password for legacy users
auth = _determine_auth(config.get("client_id", config.get("username")), config.get("client_secret", config.get("password")))
connection_args = {
"database": config["database"],
"auth": UsernamePassword(config["username"], config["password"]),
"auth": auth,
"api_endpoint": config.get("host", DEFAULT_API_URL),
"account_name": config.get("account"),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Firebolt Spec",
"type": "object",
"required": ["username", "password", "database"],
"required": ["client_id", "client_secret", "account", "database", "engine"],
"additionalProperties": false,
"properties": {
"username": {
"client_id": {
"type": "string",
"title": "Username",
"description": "Firebolt email address you use to login.",
"examples": ["[email protected]"],
"title": "Client ID",
"description": "Firebolt service account ID.",
"examples": ["bbl9qth066hmxkwyb0hy2iwk8ktez9dz"],
"order": 0
},
"password": {
"client_secret": {
"type": "string",
"title": "Password",
"description": "Firebolt password.",
"title": "Client Secret",
"description": "Firebolt secret, corresponding to the service account ID.",
"airbyte_secret": true,
"order": 1
},
Expand All @@ -44,7 +44,7 @@
"engine": {
"type": "string",
"title": "Engine",
"description": "Engine name or url to connect to."
"description": "Engine name to connect to."
},
"loading_method": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ data:
connectorSubtype: database
connectorType: destination
definitionId: 18081484-02a5-4662-8dba-b270b582f321
dockerImageTag: 0.1.1
dockerImageTag: 0.2.0
dockerRepository: airbyte/destination-firebolt
githubIssueLabel: destination-firebolt
connectorBuildOptions:
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
icon: firebolt.svg
license: MIT
name: Firebolt
Expand Down
Loading
Loading