"SQLModelConfig" has no attribute "table" #1000
-
| First Check
 Commit to Help
 Example Codefrom sqlmodel import Field, SQLModel
class Foo(SQLModel):
    field_a: str = Field(
        nullable=False,
        description='field A',
    )
print(type(Foo.model_config))  # <-- <class 'dict'>
try:
    print(f'{Foo.model_config.table = }')
except AttributeError:
    print('attr table not found')
print(f'{Foo.model_config.get("table") = }')DescriptionVS Code highlights the  Is there any way around this other than using  cast(dict[str, Any], Foo.model_config)Operating SystemLinux Operating System DetailsNo response SQLModel Version0.0.19 Python VersionPython 3.9.19 Additional ContextNo response | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            YuriiMotov
          
      
      
        Aug 20, 2025 
      
    
    Replies: 1 comment
-
| SQLModel's  Yes, unfortunately IDE fails to correctly handle this.. | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        YuriiMotov
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
SQLModel's
model_configis aTypedDictinherited from Pydantic'sBaseConfigand adds optionaltableandregistrykeys.Yes, unfortunately IDE fails to correctly handle this..
To safely access this attribute you should use
Foo.model_config.get("table")