First Check
Commit to Help
Example Code
from typing import Optional
from sqlmodel import Field, Session, SQLModel, create_engine, select
class Hero(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str
secret_name: str
age: Optional[int] = None
hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson")
hero_2 = Hero(name="Beep", secret_name="B")
engine = create_engine("sqlite:///database.db", echo=True)
SQLModel.metadata.create_all(engine)
with Session(engine) as session:
session.add(hero_1)
session.add(hero_2)
session.commit()
session.refresh(hero_1)
session.refresh(hero_2)
print(f"{hero_1=}")
print(f"{hero_2=}")
hero_names = [
"Beep",
"Boop",
"Deadpond",
"Zorf",
]
db_statement = select(Hero).where(Hero.name.in_(hero_names))
db_data = session.exec(db_statement).all()
print(f"{db_data=}")
Description
- When trying to figure out how to generate a proper
IN clause, I noticed that VSCode intellisense does not show an autocomplete option for the in_() function on a model field (although it does still appear to work as expected).
- In the example code I posted, when I type:
Hero.name.i, the in_ function does not show up.
- This really confused me, because I am new to
slqmodel and slqalchemy, and I was trying to figure out how to generate an IN clause.
- The
sqlmodel documentation also does not mention how to do this currently. I think it might be a good idea to add, since it is such a common use case.
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.10.2
Additional Context
I do have a fair number of VSCode extensions, but I don't think that is the issue, since I do get autocomplete for everything else from sqlmodel.
First Check
Commit to Help
Example Code
Description
INclause, I noticed that VSCode intellisense does not show an autocomplete option for thein_()function on a model field (although it does still appear to work as expected).Hero.name.i, thein_function does not show up.slqmodelandslqalchemy, and I was trying to figure out how to generate anINclause.sqlmodeldocumentation also does not mention how to do this currently. I think it might be a good idea to add, since it is such a common use case.Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.10.2
Additional Context
I do have a fair number of VSCode extensions, but I don't think that is the issue, since I do get autocomplete for everything else from
sqlmodel.