You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the GitHub search to find a similar question 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
bash$ flaskdbupgrade
Description
Following setup instructions.
using sqlite option
skipped step 1
step 2 (python -m scripts.create_json) appeared to work normally
skipped steps 3 and 4 (because using sqlite)
step 5 (flask db upgrade) resulted in this output:
andy@server1:/srv/9squared/flicket$ flask db upgrade
Traceback (most recent call last):
File "/home/andy/.local/bin/flask", line 8, in
sys.exit(main())
^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/flask/cli.py", line 1047, in main
cli.main()
File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/flask/cli.py", line 354, in decorator
app = __ctx.ensure_object(ScriptInfo).load_app()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/flask/cli.py", line 308, in load_app
app = locate_app(import_name, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/flask/cli.py", line 218, in locate_app import(module_name)
File "/srv/9squared/flicket/application/init.py", line 56, in
from application.flicket.models import flicket_user, flicket_models
File "/srv/9squared/flicket/application/flicket/models/flicket_models.py", line 709, in
class FlicketSubscription(PaginatedAPIMixin, Base):
File "/srv/9squared/flicket/application/flicket/models/flicket_models.py", line 720, in FlicketSubscription
user_def = db.deferred(db.select([FlicketUser.name]).where(FlicketUser.id == user_id))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/_selectable_constructors.py", line 493, in select
return Select(*entities)
^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/selectable.py", line 5160, in init
self._raw_columns = [
^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/selectable.py", line 5161, in
coercions.expect(
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 413, in expect
resolved = impl._literal_coercion(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 652, in _literal_coercion
self._raise_for_expected(element, argname)
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 1143, in _raise_for_expected
return super()._raise_for_expected(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 711, in _raise_for_expected
super()._raise_for_expected(
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 536, in _raise_for_expected
raise exc.ArgumentError(msg, code=code) from err
sqlalchemy.exc.ArgumentError: Column expression, FROM clause, or other columns clause element expected, got [<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f6099ebe200>]. Did you mean to say select(<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f6099ebe200>)?
Operating System
Linux
Operating System Details
Linux server1 5.19.0-28-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 15 09:37:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
SQLModel Version
Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'sqlmodel'
Python Version
Python 3.11.1
Additional Context
Looks like it might have been a requirements.txt problem. pip install sqlmodel appears to have fixed it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
Following setup instructions.
using sqlite option
skipped step 1
step 2 (python -m scripts.create_json) appeared to work normally
skipped steps 3 and 4 (because using sqlite)
step 5 (flask db upgrade) resulted in this output:
andy@server1:/srv/9squared/flicket$ flask db upgrade
Traceback (most recent call last):
File "/home/andy/.local/bin/flask", line 8, in
sys.exit(main())
^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/flask/cli.py", line 1047, in main
cli.main()
File "/usr/lib/python3/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/flask/cli.py", line 354, in decorator
app = __ctx.ensure_object(ScriptInfo).load_app()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/flask/cli.py", line 308, in load_app
app = locate_app(import_name, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/flask/cli.py", line 218, in locate_app
import(module_name)
File "/srv/9squared/flicket/application/init.py", line 56, in
from application.flicket.models import flicket_user, flicket_models
File "/srv/9squared/flicket/application/flicket/models/flicket_models.py", line 709, in
class FlicketSubscription(PaginatedAPIMixin, Base):
File "/srv/9squared/flicket/application/flicket/models/flicket_models.py", line 720, in FlicketSubscription
user_def = db.deferred(db.select([FlicketUser.name]).where(FlicketUser.id == user_id))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/_selectable_constructors.py", line 493, in select
return Select(*entities)
^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/selectable.py", line 5160, in init
self._raw_columns = [
^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/selectable.py", line 5161, in
coercions.expect(
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 413, in expect
resolved = impl._literal_coercion(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 652, in _literal_coercion
self._raise_for_expected(element, argname)
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 1143, in _raise_for_expected
return super()._raise_for_expected(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 711, in _raise_for_expected
super()._raise_for_expected(
File "/home/andy/.local/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 536, in _raise_for_expected
raise exc.ArgumentError(msg, code=code) from err
sqlalchemy.exc.ArgumentError: Column expression, FROM clause, or other columns clause element expected, got [<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f6099ebe200>]. Did you mean to say select(<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f6099ebe200>)?
Operating System
Linux
Operating System Details
Linux server1 5.19.0-28-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 15 09:37:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
SQLModel Version
Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'sqlmodel'
Python Version
Python 3.11.1
Additional Context
Looks like it might have been a requirements.txt problem. pip install sqlmodel appears to have fixed it.
Beta Was this translation helpful? Give feedback.
All reactions