mirror of
https://github.com/apache/superset.git
synced 2026-04-18 07:35:09 +00:00
fix: allow db driver distinction on enforced URI params (#23769)
This commit is contained in:
committed by
GitHub
parent
adde66785c
commit
6ae5388dcf
@@ -104,8 +104,11 @@ def test_convert_dttm(
|
||||
"sqlalchemy_uri,error",
|
||||
[
|
||||
("mysql://user:password@host/db1?local_infile=1", True),
|
||||
("mysql+mysqlconnector://user:password@host/db1?allow_local_infile=1", True),
|
||||
("mysql://user:password@host/db1?local_infile=0", True),
|
||||
("mysql+mysqlconnector://user:password@host/db1?allow_local_infile=0", True),
|
||||
("mysql://user:password@host/db1", False),
|
||||
("mysql+mysqlconnector://user:password@host/db1", False),
|
||||
],
|
||||
)
|
||||
def test_validate_database_uri(sqlalchemy_uri: str, error: bool) -> None:
|
||||
@@ -123,18 +126,43 @@ def test_validate_database_uri(sqlalchemy_uri: str, error: bool) -> None:
|
||||
"sqlalchemy_uri,connect_args,returns",
|
||||
[
|
||||
("mysql://user:password@host/db1", {"local_infile": 1}, {"local_infile": 0}),
|
||||
(
|
||||
"mysql+mysqlconnector://user:password@host/db1",
|
||||
{"allow_local_infile": 1},
|
||||
{"allow_local_infile": 0},
|
||||
),
|
||||
("mysql://user:password@host/db1", {"local_infile": -1}, {"local_infile": 0}),
|
||||
(
|
||||
"mysql+mysqlconnector://user:password@host/db1",
|
||||
{"allow_local_infile": -1},
|
||||
{"allow_local_infile": 0},
|
||||
),
|
||||
("mysql://user:password@host/db1", {"local_infile": 0}, {"local_infile": 0}),
|
||||
(
|
||||
"mysql+mysqlconnector://user:password@host/db1",
|
||||
{"allow_local_infile": 0},
|
||||
{"allow_local_infile": 0},
|
||||
),
|
||||
(
|
||||
"mysql://user:password@host/db1",
|
||||
{"param1": "some_value"},
|
||||
{"local_infile": 0, "param1": "some_value"},
|
||||
),
|
||||
(
|
||||
"mysql+mysqlconnector://user:password@host/db1",
|
||||
{"param1": "some_value"},
|
||||
{"allow_local_infile": 0, "param1": "some_value"},
|
||||
),
|
||||
(
|
||||
"mysql://user:password@host/db1",
|
||||
{"local_infile": 1, "param1": "some_value"},
|
||||
{"local_infile": 0, "param1": "some_value"},
|
||||
),
|
||||
(
|
||||
"mysql+mysqlconnector://user:password@host/db1",
|
||||
{"allow_local_infile": 1, "param1": "some_value"},
|
||||
{"allow_local_infile": 0, "param1": "some_value"},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_adjust_engine_params(
|
||||
|
||||
Reference in New Issue
Block a user