mirror of
https://github.com/apache/superset.git
synced 2026-04-17 23:25:05 +00:00
feat: add endpoint to fetch available DBs (#14208)
* feat: add endpoint to fetch available DBs * Fix lint
This commit is contained in:
@@ -388,3 +388,44 @@ psql: error: could not connect to server: Operation timed out
|
||||
},
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
def test_base_parameters_mixin():
|
||||
parameters = {
|
||||
"username": "username",
|
||||
"password": "password",
|
||||
"host": "localhost",
|
||||
"port": 5432,
|
||||
"database": "dbname",
|
||||
"query": {"foo": "bar"},
|
||||
}
|
||||
sqlalchemy_uri = PostgresEngineSpec.build_sqlalchemy_url(parameters)
|
||||
assert (
|
||||
sqlalchemy_uri
|
||||
== "postgresql+psycopg2://username:password@localhost:5432/dbname?foo=bar"
|
||||
)
|
||||
|
||||
parameters_from_uri = PostgresEngineSpec.get_parameters_from_uri(sqlalchemy_uri)
|
||||
assert parameters_from_uri == parameters
|
||||
|
||||
json_schema = PostgresEngineSpec.parameters_json_schema()
|
||||
assert json_schema == {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"host": {"type": "string", "description": "Hostname or IP address"},
|
||||
"username": {"type": "string", "nullable": True, "description": "Username"},
|
||||
"password": {"type": "string", "nullable": True, "description": "Password"},
|
||||
"database": {"type": "string", "description": "Database name"},
|
||||
"query": {
|
||||
"type": "object",
|
||||
"description": "Additinal parameters",
|
||||
"additionalProperties": {},
|
||||
},
|
||||
"port": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "Database port",
|
||||
},
|
||||
},
|
||||
"required": ["database", "host", "port"],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user