refactor: Ensure Flask framework leverages the Flask-SQLAlchemy session (Phase II) (#26909)

This commit is contained in:
John Bodley
2024-02-14 06:20:15 +13:00
committed by GitHub
parent 827864b939
commit 847ed3f5b0
96 changed files with 656 additions and 730 deletions

View File

@@ -14,11 +14,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=import-outside-toplevel, unused-argument
from sqlalchemy.orm.session import Session
from superset import db
def test_table_model(session: Session) -> None:
"""
@@ -28,7 +28,7 @@ def test_table_model(session: Session) -> None:
from superset.models.core import Database
from superset.tables.models import Table
engine = session.get_bind()
engine = db.session.get_bind()
Table.metadata.create_all(engine) # pylint: disable=no-member
table = Table(
@@ -44,8 +44,8 @@ def test_table_model(session: Session) -> None:
)
],
)
session.add(table)
session.flush()
db.session.add(table)
db.session.flush()
assert table.id == 1
assert table.uuid is not None