Skip to content

Commit a2754ce

Browse files
author
legolas.zhan
committed
fixed import and testcase
1 parent 4b3a5ad commit a2754ce

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

hobbit_core/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from flask import current_app
99
from sqlalchemy import BigInteger, Column, ForeignKey, func, DateTime, Sequence
1010
from sqlalchemy.orm.session import Session
11-
from flask_sqlalchemy import DefaultMeta
11+
from flask_sqlalchemy.model import DefaultMeta
1212

1313
db = current_app.hobbit_manager.db
1414

hobbit_core/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from flask import request
1717
from flask_sqlalchemy import model
1818
from sqlalchemy import UniqueConstraint
19+
from sqlalchemy.sql import text
1920
import marshmallow
2021
from marshmallow import Schema
2122

@@ -299,7 +300,7 @@ def bulk_create_or_update_on_duplicate(
299300
while len(items) > 0:
300301
batch, items = items[:batch_size], items[batch_size:]
301302
try:
302-
result = db.session.execute(sql, batch, bind=engine)
303+
result = db.session.execute(text(sql), batch, bind_arguments={'bind': engine})
303304
except Exception as e:
304305
logger.error(e, exc_info=True)
305306
logger.info(sql)

tests/test_app/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- encoding: utf-8 -*-
22
from sqlalchemy import UniqueConstraint, func, DateTime, BigInteger
3-
from flask_sqlalchemy import models_committed
3+
from flask_sqlalchemy.track_modifications import models_committed
44

55
from hobbit_core.db import Column, BaseModel, EnumExt
66

0 commit comments

Comments
 (0)