Skip to content
New issue

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

Feature/Enhancement Request: boolean data type #22

Closed
10 tasks done
k98kurz opened this issue Dec 2, 2024 · 1 comment
Closed
10 tasks done

Feature/Enhancement Request: boolean data type #22

k98kurz opened this issue Dec 2, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request planned Issue is tagged for planned resolution in a future release
Milestone

Comments

@k98kurz
Copy link
Owner

k98kurz commented Dec 2, 2024

Feature or Enhancement?

  • (x) New feature
  • ( ) Enhancement of existing feature

Description

bool column type annotations for subclasses of SqlModel should be acceptable. E.g.

class Example(SqlModel):
    columns = ('id', 'is_something', 'is_something_else')
    id: str
    is_something: bool
    is_something_else: bool|None

This entails the following:

  • When data is retrieved for such columns, if it is not a boolean, it should be cast to bool.
  • The migration system should support the boolean column datatype.
  • The tool to make a migration from a model should parse the column type annotation properly and produce a correct migration.
  • The CLI tool to generate a model class should accept --columns "is_something=bool,is_something_else=bool|None" and generate model class source with the correct type annotation.
  • Unit tests for both subclasses of SqlModel and HashedModel
  • Unit tests for joins
  • Update e2e integration test
  • Asyncql adaptation
  • Asyncql unit tests
  • Update asyncql e2e integration test

Additional context

Related to #8.

In sqlite3, true and false are understood when querying, but they are stored as 1 and 0, respectively, in the table. See https://www.sqlite.org/datatype3.html.

@k98kurz k98kurz added the enhancement New feature or request label Dec 2, 2024
@k98kurz k98kurz self-assigned this Dec 2, 2024
@k98kurz k98kurz added the planned Issue is tagged for planned resolution in a future release label Dec 2, 2024
@k98kurz k98kurz added this to the v0.6.0 milestone Dec 2, 2024
@k98kurz
Copy link
Owner Author

k98kurz commented Dec 4, 2024

Done. Will be released shortly.

@k98kurz k98kurz closed this as completed Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned Issue is tagged for planned resolution in a future release
Projects
None yet
Development

No branches or pull requests

1 participant