We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Int
int
Describe the bug
The below code is modified from here. The translated query is
SELECT artists_v20.id AS id, artists_v20.name AS name, artists_v20.country AS country FROM artists_v20 WHERE artists_v20.name = 'Jane Doe' AND artists_v20.country = 'UK' ORDER BY artists_v20.id
The int num is not passed as int
import asyncio import os from enum import Enum import databases import ormar import sqlalchemy database_url = os.environ["DATABASE_URL"] database = databases.Database(url=database_url) metadata = sqlalchemy.MetaData() class Country(int, Enum): UK = 1 US = 2 VIETNAM = 3 COLOMBIA = 4 class ArtistV20(ormar.Model): ormar_config = ormar.OrmarConfig( database=database, metadata=metadata, tablename="artists_v20", ) id: int = ormar.Integer(primary_key=True) name: str = ormar.String(max_length=100) country: Country = ormar.Enum(enum_class=Country) async def main(): if not database.is_connected: await database.connect() engine = sqlalchemy.create_engine(database_url) metadata.create_all(engine) await ArtistV20.objects.all(name="Jane Doe", country=Country.UK) if database.is_connected: await database.disconnect() if __name__ == "__main__": asyncio.run(main())
Expected behavior The country column has int type in the database, so I expect the query will using int value 1 instead of 'UK'.
country
1
'UK'
Versions (please complete the following information):
mysql Ver 8.3.0 for macos14.2 on x86_64 (Homebrew)
ormar
pydantic
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
The below code is modified from here. The translated query is
The
int
num is not passed asint
Expected behavior
The
country
column hasint
type in the database, so I expect the query will usingint
value1
instead of'UK'
.Versions (please complete the following information):
mysql Ver 8.3.0 for macos14.2 on x86_64 (Homebrew)
ormar
version: ormar==0.20.1pydantic
version: pydantic==2.5.3The text was updated successfully, but these errors were encountered: