Skip to content

How to add BIT(1) data type to field? #298

Open
@dragonballa

Description

@dragonballa

First 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

from datetime import datetime
from typing import Optional
from sqlmodel import Field, SQLModel

class Test(SQLModel, table=True):
    text: str
    code: bit[1]
    date: datetime

Description

First of all I don't know exactly what are all the available types are so I looked at the sqlalchemy import statements over at https://github.com/tiangolo/sqlmodel/blob/7fcd4fd7c5661d2621e89ebf3a87059ac91ea6d2/sqlmodel/__init__.py

However I do not see an equivalent for MySQL's BIT(1) so what can I do here? I am trying to connect to an existing MySQL table and it has a data type as BIT(1) which when I google it seems to be a Boolean? or TINYINT

Just not clear to me how I can make SQLModel work with this table containing BIT(1) as data type.

Operating System

Linux

Operating System Details

No response

SQLModel Version

0.0.6

Python Version

3.8

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions