Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #545 from Avaiga/hotfix/#544-db_driver-is-not-para…
Browse files Browse the repository at this point in the history
…meter-of-postgre-and-mysql

Hotfix2.2.2/#544 - Remove default value of "db_driver" on SQLDataNode
  • Loading branch information
trgiangdo authored Apr 14, 2023
2 parents 8869cbc + b6452ee commit 0c16734
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/taipy/core/config/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"type": "string"
},
"db_driver": {
"description": "storage_type: sql, sql_table specific. The default value of db_driver is \"ODBC Driver 17 for SQL Server\".",
"description": "storage_type: sql, sql_table specific.",
"type": "string"
},
"db_extra_args": {
Expand Down
10 changes: 4 additions & 6 deletions src/taipy/core/config/data_node_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def _configure_sql_table(
table_name: str = None,
db_port: int = 1433,
db_host: str = "localhost",
db_driver: str = "ODBC Driver 17 for SQL Server",
db_driver: str = "",
db_extra_args: Dict[str, Any] = None,
exposed_type=_EXPOSED_TYPE_PANDAS,
scope: Scope = _DEFAULT_SCOPE,
Expand All @@ -609,8 +609,7 @@ def _configure_sql_table(
db_host (str): The database host. The default value is _"localhost"_.
db_engine (str): The database engine. Possible values are _"sqlite"_, _"mssql"_, _"mysql"_, or
_"postgresql"_.
db_driver (str): The database driver. The default value is
_"ODBC Driver 17 for SQL Server"_.
db_driver (str): The database driver.
db_port (int): The database port. The default value is 1433.
db_extra_args (Dict[str, Any]): A dictionary of additional arguments to be passed into database
connection string.
Expand Down Expand Up @@ -651,7 +650,7 @@ def _configure_sql(
db_engine: str,
db_port: int = 1433,
db_host: str = "localhost",
db_driver: str = "ODBC Driver 17 for SQL Server",
db_driver: str = "",
db_extra_args: Dict[str, Any] = None,
read_query: str = None,
write_query_builder: Callable = None,
Expand All @@ -670,8 +669,7 @@ def _configure_sql(
_"postgresql"_.
db_port (int): The database port. The default value is 1433.
db_host (str): The database host. The default value is _"localhost"_.
db_driver (str): The database driver. The default value is
_"ODBC Driver 17 for SQL Server"_.
db_driver (str): The database driver.
db_extra_args (Dict[str, Any]): A dictionary of additional arguments to be passed into database
connection string.
read_query (str): The SQL query string used to read the data from the database.
Expand Down
5 changes: 3 additions & 2 deletions src/taipy/core/data/abstract_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class _AbstractSQLDataNode(DataNode):

__DB_HOST_DEFAULT = "localhost"
__DB_PORT_DEFAULT = 1433
__DB_DRIVER_DEFAULT = "ODBC Driver 17 for SQL Server"
__DB_DRIVER_DEFAULT = ""

__ENGINE_MSSQL = "mssql"
__ENGINE_SQLITE = "sqlite"
Expand Down Expand Up @@ -162,7 +162,8 @@ def _conn_string(self) -> str:
driver = self.properties.get(self.__DB_DRIVER_KEY, self.__DB_DRIVER_DEFAULT)
extra_args = self.properties.get(self.__DB_EXTRA_ARGS_KEY, {})

extra_args = {**extra_args, "driver": driver}
if driver:
extra_args = {**extra_args, "driver": driver}
for k, v in extra_args.items():
extra_args[k] = re.sub(r"\s+", "+", v)
extra_args_str = "&".join(f"{k}={str(v)}" for k, v in extra_args.items())
Expand Down
2 changes: 1 addition & 1 deletion src/taipy/core/data/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SQLDataNode(_AbstractSQLDataNode):
_"postgresql"_.
- _"db_port"_ `(int)`: The database port. The default value is 1433.
- _"db_host"_ `(str)`: The database host. The default value is _"localhost"_.
- _"db_driver"_ `(str)`: The database driver. The default value is _"ODBC Driver 17 for SQL Server"_.
- _"db_driver"_ `(str)`: The database driver.
- _"db_extra_args"_ `(Dict[str, Any])`: A dictionary of additional arguments to be passed into database
connection string.
- _"read_query"_ `(str)`: The SQL query string used to read the data from the database.
Expand Down
2 changes: 1 addition & 1 deletion src/taipy/core/data/sql_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SQLTableDataNode(_AbstractSQLDataNode):
- _"db_host"_ `(str)`: The database host. The default value is _"localhost"_.
- _"db_engine"_ `(str)`: The database engine. For now, the accepted values are _"sqlite"_, _"mssql"_,
_"mysql"_, or _"postgresql"_.
- _"db_driver"_ `(str)`: The database driver. The default value is _"ODBC Driver 17 for SQL Server"_.
- _"db_driver"_ `(str)`: The database driver.
- _"db_port"_ `(int)`: The database port. The default value is 1433.
- _"db_extra_args"_ `(Dict[str, Any])`: A dictionary of additional arguments to be passed into database
connection string.
Expand Down
2 changes: 1 addition & 1 deletion src/taipy/core/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"major": 2, "minor": 2, "patch": 1}
{"major": 2, "minor": 2, "patch": 2}

0 comments on commit 0c16734

Please sign in to comment.