feat(postgresql): dynamic schema (#23401)

This commit is contained in:
Beto Dealmeida
2023-03-17 17:53:42 -07:00
committed by GitHub
parent f4035e096f
commit 2c6f581fa6
9 changed files with 187 additions and 78 deletions

View File

@@ -131,3 +131,27 @@ def test_get_schema_from_engine_params() -> None:
"Superset is unable to determine the schema of unqualified table "
"names and enforce permissions."
)
def test_adjust_engine_params() -> None:
"""
Test the ``adjust_engine_params`` method.
"""
from superset.db_engine_specs.postgres import PostgresEngineSpec
uri = make_url("postgres://user:password@host/catalog")
assert PostgresEngineSpec.adjust_engine_params(uri, {}, None, "secret") == (
uri,
{"options": "-csearch_path=secret"},
)
assert PostgresEngineSpec.adjust_engine_params(
uri,
{"foo": "bar", "options": "-csearch_path=default -c debug=1"},
None,
"secret",
) == (
uri,
{"foo": "bar", "options": "-csearch_path=secret -cdebug=1"},
)