mysql bigint id is defined using sqlmodel and cannot be inherited #939
Unanswered
Leewinner1
asked this question in
Questions
Replies: 1 comment
-
you can't use So replace that line: id :int = Field(description='id', title="id",sa_column=Column(BigInteger,primary_key=True)) with this: id: int = Field(description='id', title="id", sa_type=BigInteger, primary_key=True) Using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/decl_base.py", line 578, in init
2024-05-12 22:22:25 self._setup_table(table)
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/decl_base.py", line 1729, in _setup_table
2024-05-12 22:22:25 table_cls(
2024-05-12 22:22:25 File "", line 2, in new
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/deprecations.py", line 281, in warned
2024-05-12 22:22:25 return fn(*args, **kwargs) # type: ignore[no-any-return]
2024-05-12 22:22:25 ^^^^^^^^^^^^^^^^^^^
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/schema.py", line 436, in new
2024-05-12 22:22:25 return cls._new(*args, **kw)
2024-05-12 22:22:25 ^^^^^^^^^^^^^^^^^^^^^
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/schema.py", line 490, in _new
2024-05-12 22:22:25 with util.safe_reraise():
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit
2024-05-12 22:22:25 raise exc_value.with_traceback(exc_tb)
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/schema.py", line 486, in _new
2024-05-12 22:22:25 table.init(name, metadata, *args, _no_init=False, **kw)
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/schema.py", line 878, in init
2024-05-12 22:22:25 self._init_items(
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/schema.py", line 231, in _init_items
2024-05-12 22:22:25 spwd(self, **kw)
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/base.py", line 1337, in _set_parent_with_dispatch
2024-05-12 22:22:25 self._set_parent(parent, **kw)
2024-05-12 22:22:25 File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/schema.py", line 2317, in _set_parent
2024-05-12 22:22:25 raise exc.ArgumentError(
2024-05-12 22:22:25 sqlalchemy.exc.ArgumentError: Column object 'id' already assigned to Table 'tb_admin
I'm using sa_column=Column(BigInteger,primary_key=True) so I'm going to throw an error whenever my subclass inherits
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.14
Python Version
3.11
Additional Context
Beta Was this translation helpful? Give feedback.
All reactions