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
Describe the bug
Auto create-table fails on bool fields. System thinks field name is bool value (True)
(bool broke)
Debugging table schemas:
task schema: id: <class 'int'> (<class 'type'>) title: <class 'str'> (<class 'type'>) done: <class 'bool'> (<class 'type'>) priority: <class 'int'> (<class 'type'>) profile_id: <class 'int'> (<class 'type'>) pk: id (<class 'str'>) Traceback (most recent call last): File "/home/mike/repos/botifython/botifymograph.py", line 2147, in app, rt, (tasks, Task) = debug_fast_app( ^^^^^^^^^^^^^^^ File "/home/mike/repos/botifython/botifymograph.py", line 2142, in debug_fast_app result = fast_app(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/fasthtml/fastapp.py", line 84, in fast_app dbtbls = [_get_tbl(db.t, k, v) for k,v in tbls.items()] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/fasthtml/fastapp.py", line 84, in dbtbls = [_get_tbl(db.t, k, v) for k,v in tbls.items()] ^^^^^^^^^^^^^^^^^^^^ File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/fasthtml/fastapp.py", line 16, in _get_tbl if tbl not in dt: tbl.create(**schema) ^^^^^^^^^^^^^^^^^^^^ File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/fastlite/kw.py", line 80, in create return self._orig_create( ^^^^^^^^^^^^^^^^^^ File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/sqlite_minutils/db.py", line 1645, in create self.db.create_table( File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/sqlite_minutils/db.py", line 997, in create_table sql = self.create_table_sql( ^^^^^^^^^^^^^^^^^^^^^^ File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/sqlite_minutils/db.py", line 876, in create_table_sql column_type=COLUMN_TYPE_MAPPING[column_type], ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ KeyError: True
Minimal Reproducible Example
# Debug wrapper def debug_fast_app(*args, **kwargs): print("\nDebugging table schemas:") for k, v in kwargs.items(): if isinstance(v, dict) and 'pk' in v: # This identifies our table schemas print(f"\n{k} schema:") for field, type_ in v.items(): print(f" {field}: {type_} ({type(type_)})") result = fast_app(*args, **kwargs) return result app, rt, (tasks, Task) = debug_fast_app( "data/data.db", live=True, task={ "id": int, "title": str, "done": bool, "priority": int, "profile_id": int, "pk": "id" } )
Expected behavior Table to be created
Environment Information FAILS ON FASTHTML VERSIONS 0.7.0 to 0.10.0
Name: fastlite Version: 0.0.13
Name: fastcore Version: 1.7.20
Name: python-fasthtml Version: 0.10.0
THE VERSION IT WORKS UNDER <-- Pinning to 0.6.14 (at the latest) fixes
Name: python-fasthtml Version: 0.6.14
Confirmation Please confirm the following:
Additional context Impossible to believe I'm the only one encounterng / reporting as it is THE use case example.
The text was updated successfully, but these errors were encountered:
@pydanny @audreyfeldroy would you like to look at this one?
Sorry, something went wrong.
pydanny
audreyfeldroy
No branches or pull requests
Describe the bug
Auto create-table fails on bool fields. System thinks field name is bool value (True)
(bool broke)
Debugging table schemas:
task schema:
id: <class 'int'> (<class 'type'>)
title: <class 'str'> (<class 'type'>)
done: <class 'bool'> (<class 'type'>)
priority: <class 'int'> (<class 'type'>)
profile_id: <class 'int'> (<class 'type'>)
pk: id (<class 'str'>)
Traceback (most recent call last):
File "/home/mike/repos/botifython/botifymograph.py", line 2147, in
app, rt, (tasks, Task) = debug_fast_app(
^^^^^^^^^^^^^^^
File "/home/mike/repos/botifython/botifymograph.py", line 2142, in debug_fast_app
result = fast_app(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/fasthtml/fastapp.py", line 84, in fast_app
dbtbls = [_get_tbl(db.t, k, v) for k,v in tbls.items()]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/fasthtml/fastapp.py", line 84, in
dbtbls = [_get_tbl(db.t, k, v) for k,v in tbls.items()]
^^^^^^^^^^^^^^^^^^^^
File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/fasthtml/fastapp.py", line 16, in _get_tbl
if tbl not in dt: tbl.create(**schema)
^^^^^^^^^^^^^^^^^^^^
File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/fastlite/kw.py", line 80, in create
return self._orig_create(
^^^^^^^^^^^^^^^^^^
File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/sqlite_minutils/db.py", line 1645, in create
self.db.create_table(
File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/sqlite_minutils/db.py", line 997, in create_table
sql = self.create_table_sql(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/mike/repos/botifython/.venv/lib/python3.11/site-packages/sqlite_minutils/db.py", line 876, in create_table_sql
column_type=COLUMN_TYPE_MAPPING[column_type],
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: True
Minimal Reproducible Example
Expected behavior
Table to be created
Environment Information
FAILS ON FASTHTML VERSIONS 0.7.0 to 0.10.0
Name: fastlite
Version: 0.0.13
Name: fastcore
Version: 1.7.20
Name: python-fasthtml
Version: 0.10.0
THE VERSION IT WORKS UNDER <-- Pinning to 0.6.14 (at the latest) fixes
Name: fastlite
Version: 0.0.13
Name: fastcore
Version: 1.7.20
Name: python-fasthtml
Version: 0.6.14
Confirmation
Please confirm the following:
Additional context
Impossible to believe I'm the only one encounterng / reporting as it is THE use case example.
The text was updated successfully, but these errors were encountered: