Is it normal unable to use autocomplete for SQLModel class field?
See original GitHub issueFirst Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn’t find it.
- I searched the SQLModel documentation, with the integrated search.
- I already searched in Google “How to X in SQLModel” and didn’t find any information.
- I already read and followed all the tutorial in the docs and didn’t find an answer.
- I already checked if it is not related to SQLModel but to Pydantic.
- I already checked if it is not related to SQLModel but to SQLAlchemy.
Commit to Help
- I commit to help with one of those options 👆
Example Code
class Hero1(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str
secret_name: str
age: Optional[int] = None
class Hero2():
id: Optional[int] = Field(default=None, primary_key=True)
name: str
secret_name: str
age: Optional[int] = None
Description
I’m using Pycharm.
When I write code like,
select(Hero1).where(Hero1.age > 35)
I expect IDE to show field ‘age’ when I type ‘Hero1.’ but IDE autocomplete displays no fields of Hero1. but with Hero2 (without SQLModel inherits), it surely works fine.
Is this normal or only my IDE problem?
Operating System
Windows
Operating System Details
windows 10 Pycharm 2022
SQLModel Version
0.0.8
Python Version
3.10.6
Additional Context
Issue Analytics
- State:
- Created a year ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Create a Table with SQLModel - Use the Engine
The next step is to define the fields or columns of the class by using standard ... But inside the SQL database, it...
Read more >Simple instructions for a self referential table #127 - GitHub
I am only a litte familiar with SQL alchemy but was unable to translate their example into one that would work with SQLmodel....
Read more >SQLModel: SQL DBs based on Python type hints. The ... - Reddit
And you can also use inheritance to avoid duplication of fields/columns, but customize, include, exclude fields in the data models for input and ......
Read more >SQLModel is the Pydantic inspired Python ORM we ... - YouTube
The first 1000 people to use this link will get a 1 month free trial of Skillshare: https://skl.sh/johnwatsonrooney03221An ORM provides a ...
Read more >How to get Alembic to recognise SQLModel database model?
There should be info about that in Advanced user guide soon with better explanation than mine but here is how I made Alimbic...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s probably that PyCharm still doesn’t support dataclass_transform, that’s a new standard in Python and it was adopted by Pydantic and SQLModel even before it was an official standard.
You can probably ask them to add support for it. 🤓
Just a note, autocompletion for attributes would work even without support for dataclass_transform. What dataclass_transform would help with is autocompletion for parameters when creating a new instance of the class.