Skip to content

Commit

Permalink
apache druid datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
gagan-bhullar-tech committed Nov 6, 2024
1 parent 1a84a6d commit eac8be8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ibis-server/app/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class QueryPostgresDTO(QueryDTO):

class QuerySnowflakeDTO(QueryDTO):
connection_info: SnowflakeConnectionInfo = connection_info_field


class QueryDruidDTO(QueryDTO):
connection_info: DruidConnectionInfo = connection_info_field

class QueryDruidDTO(QueryDTO):
connection_info: DruidConnectionInfo = connection_info_field
Expand Down Expand Up @@ -79,6 +81,10 @@ class ClickHouseConnectionInfo(BaseModel):
user: SecretStr
password: SecretStr

class DruidConnectionInfo(BaseModel):
host: SecretStr = Field(examples=["localhost"])
port: SecretStr = Field(examples=[8082])
path: str

class DruidConnectionInfo(BaseModel):
host: SecretStr = Field(examples=["localhost"])
Expand Down Expand Up @@ -139,7 +145,6 @@ class TrinoConnectionInfo(BaseModel):
user: SecretStr | None = None
password: SecretStr | None = None


ConnectionInfo = (
BigQueryConnectionInfo
| CannerConnectionInfo
Expand Down
9 changes: 9 additions & 0 deletions ibis-server/app/model/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
QueryClickHouseDTO,
QueryDruidDTO,
QueryDTO,
QueryDruidDTO,
QueryMSSqlDTO,
QueryMySqlDTO,
QueryPostgresDTO,
Expand Down Expand Up @@ -111,6 +112,14 @@ def get_clickhouse_connection(info: ClickHouseConnectionInfo) -> BaseBackend:
user=info.user.get_secret_value(),
password=info.password.get_secret_value(),
)

@staticmethod
def get_druid_connection(info: DruidConnectionInfo) -> BaseBackend:
return ibis.druid.connect(
host=info.host.get_secret_value(),
port=int(info.port.get_secret_value()),
path=info.path,
)

@staticmethod
def get_druid_connection(info: DruidConnectionInfo) -> BaseBackend:
Expand Down

0 comments on commit eac8be8

Please sign in to comment.