|
7 | 7 |
|
8 | 8 | class DatabaseConnector: |
9 | 9 | """ |
10 | | - A class that manages connections to various database types and executes SQLY queries. |
| 10 | + A class that manages connections to various database types and executes |
| 11 | + SQLY queries. |
11 | 12 |
|
12 | 13 | This class serves as an abstraction layer over different database connectors, |
13 | | - allowing for a unified interface to execute queries across different database systems |
14 | | - such as SQLite, MariaDB, PostgreSQL, Oracle, and MS SQL Server. |
| 14 | + allowing for a unified interface to execute queries across different |
| 15 | + database systems such as SQLite, MariaDB, PostgreSQL, Oracle, |
| 16 | + and MS SQL Server. |
15 | 17 |
|
16 | 18 | Attributes: |
17 | 19 | db_type: The type of the database being connected to. |
18 | | - connection: The connection parameters or object needed to establish a database connection. |
19 | | - connector: The actual database connector instance used to interact with the database. |
| 20 | + connection: The connection parameters or object needed to establish a |
| 21 | + connection. |
| 22 | + connector: The actual database connector instance used to interact with |
| 23 | + the database. |
20 | 24 |
|
21 | 25 | Examples: |
22 | 26 | >>> connector = DatabaseConnector("sqlite", ":memory:") |
23 | | - >>> result = connector.execute_query({"select": ["id", "name"], "from": "users"}) |
| 27 | + >>> result = connector.execute_query({"select": ["id", "name"], |
| 28 | + "from": "users"}) |
24 | 29 | """ |
25 | 30 |
|
26 | 31 | def __init__(self, db_type: str, connection: Any) -> None: |
27 | 32 | """ |
28 | | - Initialize the DatabaseConnector with the database type and connection information. |
| 33 | + Initialize the DatabaseConnector with the database type and connection |
| 34 | + information. |
29 | 35 |
|
30 | 36 | Args: |
31 | 37 | db_type: The type of the database (e.g., "sqlite", "mariadb", |
@@ -69,7 +75,8 @@ def execute_query( |
69 | 75 | The result of the executed query. |
70 | 76 |
|
71 | 77 | Raises: |
72 | | - SQLYExecutionError: If the query is invalid or an error occurs during execution. |
| 78 | + SQLYExecutionError: If the query is invalid or an error occurs during |
| 79 | + execution. |
73 | 80 | """ |
74 | 81 | # Use provided values or fall back to instance attributes |
75 | 82 | db_type = db_type or self.db_type |
|
0 commit comments