I want to update my SQLite DB with data provided by an external API and I don't want to check every time for any conflicts by myself, instead, I want to take advantage of UPSERT statement. SQLAlchemy documentation for version 1.4 (still in beta but that's ok) shows that this is possible. But I don't know how to get this to work with flask_sqlalchemy.
I've also tried to include sqlite_on_conflict='IGNORE' in constraint definitions (as mentioned in SQLAlchemy docs for version 1.3 here):
class SomeModel(db.Model):
__table_args__ = (
db.ForeignKeyConstraint(
('id', 'other_id'),
('other_table.id', 'other_table.other_id')
sqlite_on_conflict='IGNORE'
),
)
# ...
I then verified SQL output with SQLALCHEMY_ECHO set to True and it didn't work at all...
I tried with both 1.3 and 1.4 SQLAlchemy versions.