reflex-dev / templates

21 stars 9 forks source link

Remove alembic #37

Open Alek99 opened 1 week ago

masenf commented 1 week ago

Why are we removing these? Now users will have to also do reflex db init before the app can be used.

Alek99 commented 1 week ago

Why are we removing these? Now users will have to also do reflex db init before the app can be used.

Isn't it more confusing to get an error like this when first downloading reflex, picking a template and doing reflex run?

[Reflex Backend Exception]
 Traceback (most recent call last):
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: customer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/alekpetuskey/Desktop/Open Source/pynecone/reflex/state.py", line 1641, in _process_event
    events = fn(**payload)
             ^^^^^^^^^^^^^
  File "/Users/alekpetuskey/Desktop/Open Source/pynecone/examples/testsale/testsale/backend/backend.py", line
99, in load_entries
    self.users = session.exec(query).all()
                 ^^^^^^^^^^^^^^^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlmodel/orm/session.py", line 66, in exec
    results = super().execute(
              ^^^^^^^^^^^^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/orm/session.py", line 2362, in execute
    return self._execute_internal(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/orm/session.py", line 2247, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/orm/context.py", line 305, in orm_execute_statement
    result = conn.execute(
             ^^^^^^^^^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
           ^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File 
"/Users/alekpetuskey/Library/Caches/pypoetry/virtualenvs/reflex-PQ1dIs0F-py3.12/lib/python3.12/site-packages/
sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: customer
[SQL: SELECT customer.id, customer.customer_name, customer.email, customer.age, customer.gender, 
customer.location, customer.job, customer.salary 
FROM customer]
(Background on this error at: https://sqlalche.me/e/20/e3q8)

There is an warning message Target database is not up to date. Run reflex db migrate to update database.

But in a first install would be easily over looked. Then when they up the app and get the error message from above its not really clear how to resolve it

Alek99 commented 1 week ago
Screenshot 2024-10-10 at 8 43 17 PM

Should we cut the command at the red message instead of continuing to run?