Closed ErikvdVen closed 11 months ago
I think there is a conflict with my own transactionS table and the transaction table of SQLAlchemy Continuum, is there a way to tell the package to use a different table name or whateveer? Or is it best to change my own table name?
I get the same error over and over again, no matter which model tries to insert something into the database. Same insert on the same table with the same error.
Fixed it by migrating my own table "transactions" (including constraints, foreign keys etc) to "bank_transactions". Had to use configure_mappers()
function anyways, though I thought I wouldn't. I'm calling that function now inside the __init__.py
, of the models folder, after importing all classes. Thought that would be the best place.
make_versioned(user_cls=None)
is called on the database.py (wondering what user_cls is for, though).
Seems to work fine now.
SQLAlchemy Continuum tries to add an empty row to the database, when I try to update an existing record:
This is the code:
I've changed my models, so the active column can't hold a default value anymore, so now it fails. If I enable the active column to have a default value, then it updates the existing record, but it also adds an empty row to both the version table as well as the actual table which contains the transactions. I've no clue why this is happening. This is my database.py:
I use
declarative_base()
instead ofconfigure_mappers
. Tables are created and rows are inserted in the version tables, so that should be all good. The only issue is the empty rows which are added when updating an existing row. The version table gets two rows inserted: one with the update that happened and an empty row telling an insert happened. At first, I thought the inserts were an issue, but then I figured actual empty rows were inserted in the transactions table.Now I get an error because I refuse the active column of having a default value. If I change my model by telling the active column can contain a default value, empty rows are inserted.
Any thoughts?