mirror of https://github.com/apache/superset.git
fix: unexpected commit causes pytest failure (#20780)
This commit is contained in:
parent
3311128c5e
commit
922b4b8d1d
|
@ -39,10 +39,7 @@ def get_or_create_db(
|
||||||
from superset.models import core as models
|
from superset.models import core as models
|
||||||
|
|
||||||
database = (
|
database = (
|
||||||
db.session.query(models.Database)
|
db.session.query(models.Database).filter_by(database_name=database_name).first()
|
||||||
.filter_by(database_name=database_name)
|
|
||||||
.autoflush(False)
|
|
||||||
.first()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# databases with a fixed UUID
|
# databases with a fixed UUID
|
||||||
|
@ -56,8 +53,11 @@ def get_or_create_db(
|
||||||
database_name=database_name, uuid=uuids.get(database_name)
|
database_name=database_name, uuid=uuids.get(database_name)
|
||||||
)
|
)
|
||||||
db.session.add(database)
|
db.session.add(database)
|
||||||
|
database.set_sqlalchemy_uri(sqlalchemy_uri)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
if database:
|
# todo: it's a bad idea to do an update in a get/create function
|
||||||
|
if database and database.sqlalchemy_uri_decrypted != sqlalchemy_uri:
|
||||||
database.set_sqlalchemy_uri(sqlalchemy_uri)
|
database.set_sqlalchemy_uri(sqlalchemy_uri)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue