Skip to content

Getting "Column object 'editable_by' already assigned to Table 'mytable'" when I update lasted version of sqlmodel (0.0.14) #743

Answered by balocon
balocon asked this question in Questions
Discussion options

You must be logged in to vote

Code run using "sa_type" instead "sa_column".

from typing import Optional, List, Type

from sqlmodel import Field, SQLModel, Column, ARRAY, String

from datetime import datetime




# This is a very basic model with more field and functions valid for all tables in this project
class HeroBase(SQLModel):
    id: Optional[int] = Field(default=None, primary_key=True)
    name: str = Field(index=True)
    secret_name: Optional[List[str]] = Field(sa_type=ARRAY(String))  # <----
    age: Optional[int] = Field(default=None, index=True)


# This is a first aproximation of one type of table in the project (still could be a model for more projects)
class Model_A(HeroBase):
    favorite_color: Option…

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@orenl
Comment options

Answer selected by balocon
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@CodyManshack
Comment options

@0snug0
Comment options

@0snug0
Comment options

@CodyManshack
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
7 participants