I started getting errors when trying to write values to tree object columns. I am not able to make sense of it, but suspect it may have something to do with sqlalchemy 2+.
Anyone know what this stacktrace means?
Traceback (most recent call last):
File "/venv/lib/python3.10/site-packages/werkzeug/serving.py", line 362, in run_wsgi
execute(self.server.app)
File "/venv/lib/python3.10/site-packages/werkzeug/serving.py", line 323, in execute
application_iter = app(environ, start_response)
File "/venv/lib/python3.10/site-packages/flask/app.py", line 1478, in __call__
return self.wsgi_app(environ, start_response)
File "/venv/lib/python3.10/site-packages/flask/app.py", line 1458, in wsgi_app
response = self.handle_exception(e)
File "/venv/lib/python3.10/site-packages/flask/app.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
File "/venv/lib/python3.10/site-packages/flask/app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/venv/lib/python3.10/site-packages/flask/app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "/venv/lib/python3.10/site-packages/flask/app.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/venv/lib/python3.10/site-packages/flask_login/utils.py", line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File "/app/admin/routes.py", line 268, in edit_match_string
db.session.commit()
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/scoping.py", line 598, in commit
return self._proxied.commit()
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1969, in commit
trans.commit(_to_root=True)
File "<string>", line 2, in commit
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
ret_value = fn(self, *arg, **kw)
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1256, in commit
self._prepare_impl()
File "<string>", line 2, in _prepare_impl
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
ret_value = fn(self, *arg, **kw)
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1231, in _prepare_impl
self.session.flush()
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4312, in flush
self._flush(objects)
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4447, in _flush
with util.safe_reraise():
File "/venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
raise exc_value.with_traceback(exc_tb)
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4408, in _flush
flush_context.execute()
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
rec.execute(self)
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
util.preloaded.orm_persistence.save_obj(
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 54, in save_obj
save_obj(base_mapper, [state], uowtransaction, single=True)
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 60, in save_obj
for (
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 234, in _organize_states_for_save
mapper.dispatch.before_update(mapper, connection, state)
File "/venv/lib/python3.10/site-packages/sqlalchemy/event/attr.py", line 487, in __call__
fn(*args, **kw)
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/events.py", line 887, in wrap
fn(*arg, **kw)
File "/venv/lib/python3.10/site-packages/sqlalchemy_mptt/events.py", line 579, in before_update
mptt_before_update(mapper, connection, instance)
File "/venv/lib/python3.10/site-packages/sqlalchemy_mptt/events.py", line 323, in mptt_before_update
select([table_pk])
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/_selectable_constructors.py", line 489, in select
return Select(*entities)
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/selectable.py", line 5136, in __init__
self._raw_columns = [
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/selectable.py", line 5137, in <listcomp>
coercions.expect(
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 413, in expect
resolved = impl._literal_coercion(
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 651, in _literal_coercion
self._raise_for_expected(element, argname)
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 1139, in _raise_for_expected
return super()._raise_for_expected(
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 710, in _raise_for_expected
super()._raise_for_expected(
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/coercions.py", line 535, in _raise_for_expected
raise exc.ArgumentError(msg, code=code) from err
sqlalchemy.exc.ArgumentError: Column expression, FROM clause, or other columns clause element expected, got [Column('id', Integer(), table=<category>, primary_key=True, nullable=False)]. Did you mean to say select(Column('id', Integer(), table=<category>, primary_key=True, nullable=False))?
I started getting errors when trying to write values to tree object columns. I am not able to make sense of it, but suspect it may have something to do with sqlalchemy 2+.
Anyone know what this stacktrace means?