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

[BUG] TypeError for tables with not_null and defaults parameters #542

Open
4 tasks done
Artem-Ter opened this issue Oct 24, 2024 · 0 comments
Open
4 tasks done

[BUG] TypeError for tables with not_null and defaults parameters #542

Artem-Ter opened this issue Oct 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Artem-Ter
Copy link

Describe the bug
Creating a table in database using not_null = set(...) and/or defaults=dict(...) parameters you get TypeError: unhashable type: 'set' or 'dict' accordingly

Minimal Reproducible Example

import fasthml.common as fh

db = fh.database('test.db')

users = db.t.users

users.drop()
users.create(
            {
                "id":int,
                "name":str,
                "email":str,
                "pwd":str,
                "phone":str,
                "organization":str,
                "role":int
            },
            pk='id',
            not_null={'email'},
            defaults={'role': 1},
        )

Expected behavior
Create table with defaults and not null constraints

Environment Information

  • fastlite version: "0.0.11"
  • fastcore version: "1.7.14"
  • fasthtml version: "0.6.10"

Confirmation
Please confirm the following:

  • I have read the FAQ (https://docs.fastht.ml/explains/faq.html)
  • I have provided a minimal reproducible example
  • I have included the versions of fastlite, fastcore, and fasthtml
  • I understand that this is a volunteer open source project with no commercial support.
@Artem-Ter Artem-Ter added the bug Something isn't working label Oct 24, 2024
@Artem-Ter Artem-Ter changed the title [BUG] [BUG] TypeError for tabels with not_null and defaults parameters Oct 24, 2024
@pydanny pydanny changed the title [BUG] TypeError for tabels with not_null and defaults parameters [BUG] TypeError for tables with not_null and defaults parameters Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant