forked from numaproj/numalogic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding utilities to connect AWS services like RDS adding AWS Dataservices connectors utilities ---- Signed-off-by: Saisharath <[email protected]> Signed-off-by: skondakindi <[email protected]>
- Loading branch information
skondakindi
committed
Apr 11, 2024
1 parent
c4811f1
commit 4597e76
Showing
13 changed files
with
322 additions
and
305 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ class ConnectorType(IntEnum): | |
redis = 0 | ||
prometheus = 1 | ||
druid = 2 | ||
rds = 3 | ||
|
||
|
||
@dataclass | ||
|
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 |
---|---|---|
@@ -1,36 +1,34 @@ | ||
import logging | ||
|
||
from numalogic.connectors.utils.aws.config import DatabaseTypes | ||
from numalogic.connectors.utils.aws.exceptions import UnRecognizedDatabaseTypeException | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class RdsFactory: | ||
""" | ||
Class: RdsFactory. | ||
"""class represents a factory for creating database handlers for different database types.""" | ||
|
||
This class represents a factory for creating database handlers for different database types. | ||
@classmethod | ||
def get_db_handler(cls, database_type: DatabaseTypes): | ||
""" | ||
Get the database handler for the specified database type. | ||
Methods | ||
------- | ||
- get_db_handler(database_type: str) -> Type[DatabaseHandler]: | ||
- This method takes a database_type as input and returns | ||
the corresponding database handler class. | ||
- If the database_type is "mysql", it returns the MysqlFetcher class from | ||
the numalogic.connectors.rds.db.mysql_fetcher module. | ||
- If the database_type is not supported, it returns None. | ||
Args: | ||
- database_type (str): The type of the database. | ||
""" | ||
Returns | ||
------- | ||
- The database handler for the specified database type. | ||
@classmethod | ||
def get_db_handler(cls, database_type: str): | ||
db_class = None | ||
if database_type == "mysql": | ||
Raises | ||
------ | ||
- UnRecognizedDatabaseTypeException: If the specified database type is not supported. | ||
""" | ||
if database_type == DatabaseTypes.MYSQL.value: | ||
from numalogic.connectors.rds.db.mysql_fetcher import MysqlFetcher | ||
|
||
db_class = MysqlFetcher | ||
else: | ||
raise UnRecognizedDatabaseTypeException( | ||
f"database_type: {database_type} is not supported" | ||
) | ||
return db_class | ||
return MysqlFetcher | ||
|
||
raise UnRecognizedDatabaseTypeException(f"database_type: {database_type} is not supported") |
Oops, something went wrong.