-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add: oracle integration * fix: docker compose and datasource type --------- Co-authored-by: subhankarb <subhankar@waterdip.ai>
- Loading branch information
1 parent
3a5e1ec
commit 80c8097
Showing
7 changed files
with
144 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2022-present, the Waterdip Labs Pvt. Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from typing import Any, Dict | ||
|
||
from sqlalchemy import create_engine | ||
from sqlalchemy.engine import URL | ||
|
||
from dcs_core.core.common.errors import DataChecksDataSourcesConnectionError | ||
from dcs_core.core.datasource.sql_datasource import SQLDataSource | ||
|
||
|
||
class OracleDataSource(SQLDataSource): | ||
def __init__(self, data_source_name: str, data_connection: Dict): | ||
super().__init__(data_source_name, data_connection) | ||
|
||
def connect(self) -> Any: | ||
""" | ||
Connect to the data source | ||
""" | ||
try: | ||
engine = create_engine( | ||
f"oracle+oracledb://:@", | ||
thick_mode=False, | ||
connect_args={ | ||
"user": self.data_connection.get("username"), | ||
"password": self.data_connection.get("password"), | ||
"host": self.data_connection.get("host"), | ||
"port": self.data_connection.get("port"), | ||
"service_name": self.data_connection.get("service_name"), | ||
}, | ||
) | ||
self.connection = engine.connect() | ||
return self.connection | ||
except Exception as e: | ||
raise DataChecksDataSourcesConnectionError( | ||
message=f"Failed to connect to Oracle data source: [{str(e)}]" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.