I'm encountering issues downloading a sandbox project locally with EA 0.1.77 from cleaning this notebook.
Launch the Encord Active app with the sandbox project included.
{
"name": "OperationalError",
"message": "(sqlite3.OperationalError) near \"DROP\": syntax error
[SQL: ALTER TABLE active_project_analytics_data DROP COLUMN metric_annotation_quality]
(Background on this error at: https://sqlalche.me/e/14/e3q8)",
"stack": "---------------------------------------------------------------------------
OperationalError Traceback (most recent call last)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1900, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
1899 if not evt_handled:
-> 1900 self.dialect.do_execute(
1901 cursor, statement, parameters, context
1902 )
1904 if self._has_events or self.engine._has_events:
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/engine/default.py:736, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
735 def do_execute(self, cursor, statement, parameters, context=None):
--> 736 cursor.execute(statement, parameters)
OperationalError: near \"DROP\": syntax error
The above exception was the direct cause of the following exception:
OperationalError Traceback (most recent call last)
/home/stephen/encord/encord-notebooks/notebooks/01_Encord_Active_Notebooks___Download_sandbox_project.ipynb Cell 17 line 5
<a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/stephen/encord/encord-notebooks/notebooks/01_Encord_Active_Notebooks___Download_sandbox_project.ipynb#X22sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a> project_path = Path.cwd() / project_name
<a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/stephen/encord/encord-notebooks/notebooks/01_Encord_Active_Notebooks___Download_sandbox_project.ipynb#X22sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'>4</a> # Download the dataset
----> <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/home/stephen/encord/encord-notebooks/notebooks/01_Encord_Active_Notebooks___Download_sandbox_project.ipynb#X22sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'>5</a> fetch_prebuilt_project(project_name, project_path)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/encord_active/lib/project/sandbox_projects/sandbox_projects.py:199, in fetch_prebuilt_project(project_name, out_dir, unpack, progress_callback)
196 return output_file_path
198 unpacked_archive_path = unpack_archive(output_file_path, out_dir)
--> 199 ensure_safe_project(unpacked_archive_path)
200 return unpacked_archive_path
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/encord_active/cli/utils/server.py:31, in ensure_safe_project(root_path, final_data_version)
29 ensure_initialised_merged_metrics(project_file_structure)
30 ensure_prisma_db(project_file_structure.prisma_db)
---> 31 run_data_migrations(project_file_structure, final_data_version=final_data_version)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/encord_active/lib/db/data/run_data_migrations.py:44, in run_data_migrations(pfs, final_data_version)
42 sys.modules[\"module.name\"] = migration
43 spec.loader.exec_module(migration)
---> 44 migration.up(pfs)
46 # This can be conditionally disabled for ease of debugging variations in the project version.
47 if os.environ.get(\"ENCORD_ACTIVE_DEBUGGING_DISABLE_MIGRATION_TIMESTAMPS\", \"0\") != \"1\":
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/encord_active/lib/db/data/migrations/202306141900_fill_global_db.py:34, in up(pfs)
32 batch.commit()
33 # Run database migration script
---> 34 migrate_disk_to_db(pfs)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/encord_active/db/scripts/migrate_disk_to_db.py:1225, in migrate_disk_to_db(pfs, delete_existing_project)
1213 metrics_db_data_extra = [
1214 ProjectDataAnalyticsExtra(
1215 project_hash=project_hash,
(...)
1221 for (du_hash, frame), (embeddings, metric_metadata) in data_metric_extra.items()
1222 ]
1224 path = database_dir / \"encord-active.sqlite\"
-> 1225 engine = get_engine(path)
1226 if delete_existing_project:
1227 delete_project_from_db(engine, project_hash)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/encord_active/db/models.py:611, in get_engine(path, concurrent, use_alembic)
608 os.chdir(alembic_cwd)
609 import alembic.config
--> 611 alembic.config.main(argv=alembic_args[1:])
612 finally:
613 os.chdir(current_cwd)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/config.py:630, in main(argv, prog, **kwargs)
627 def main(argv=None, prog=None, **kwargs):
628 \"\"\"The console runner function for Alembic.\"\"\"
--> 630 CommandLine(prog=prog).main(argv=argv)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/config.py:624, in CommandLine.main(self, argv)
618 else:
619 cfg = Config(
620 file_=options.config,
621 ini_section=options.name,
622 cmd_opts=options,
623 )
--> 624 self.run_cmd(cfg, options)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/config.py:601, in CommandLine.run_cmd(self, config, options)
598 fn, positional, kwarg = options.cmd
600 try:
--> 601 fn(
602 config,
603 *[getattr(options, k, None) for k in positional],
604 **{k: getattr(options, k, None) for k in kwarg},
605 )
606 except util.CommandError as e:
607 if options.raiseerr:
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/command.py:382, in upgrade(config, revision, sql, tag)
371 return script._upgrade_revs(revision, rev)
373 with EnvironmentContext(
374 config,
375 script,
(...)
380 tag=tag,
381 ):
--> 382 script.run_env()
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/script/base.py:578, in ScriptDirectory.run_env(self)
569 def run_env(self) -> None:
570 \"\"\"Run the script environment.
571
572 This basically runs the ``env.py`` script present
(...)
576
577 \"\"\"
--> 578 util.load_python_file(self.dir, \"env.py\")
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/util/pyfiles.py:93, in load_python_file(dir_, filename)
91 if ext == \".py\":
92 if os.path.exists(path):
---> 93 module = load_module_py(module_id, path)
94 else:
95 pyc_path = pyc_file_from_path(path)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/util/pyfiles.py:109, in load_module_py(module_id, path)
107 assert spec
108 module = importlib.util.module_from_spec(spec)
--> 109 spec.loader.exec_module(module) # type: ignore
110 return module
File <frozen importlib._bootstrap_external>:850, in exec_module(self, module)
File <frozen importlib._bootstrap>:228, in _call_with_frames_removed(f, *args, **kwds)
File migrations/env.py:91
File migrations/env.py:85, in run_migrations_online()
File <string>:8, in run_migrations(*args, **kw)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/runtime/environment.py:922, in EnvironmentContext.run_migrations(self, **kw)
920 assert self._migration_context is not None
921 with Operations.context(self._migration_context):
--> 922 self.get_context().run_migrations(**kw)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/runtime/migration.py:624, in MigrationContext.run_migrations(self, **kw)
620 if self.as_sql:
621 self.impl.static_output(
622 \"-- Running %s\" % (step.short_log,)
623 )
--> 624 step.migration_fn(**kw)
626 # previously, we wouldn't stamp per migration
627 # if we were in a transaction, however given the more
628 # complex model that involves any number of inserts
629 # and row-targeted updates and deletes, it's simpler for now
630 # just to run the operations on every version
631 head_maintainer.update_to_step(step)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/encord_active/db/migrations/versions/bcfdfc2f498a_init2.py:23, in upgrade()
18 def upgrade() -> None:
19 # ### commands auto generated by Alembic - please adjust! ###
20 op.drop_index(
21 \"active_data_project_hash_metric_annotation_quality_index\", table_name=\"active_project_analytics_data\"
22 )
---> 23 op.drop_column(\"active_project_analytics_data\", \"metric_annotation_quality\")
File <string>:8, in drop_column(*args, **kw)
File <string>:3, in drop_column(self, table_name, column_name, schema, **kw)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/operations/ops.py:2271, in DropColumnOp.drop_column(cls, operations, table_name, column_name, schema, **kw)
2233 \"\"\"Issue a \"drop column\" instruction using the current
2234 migration context.
2235
(...)
2267
2268 \"\"\"
2270 op = cls(table_name, column_name, schema=schema, **kw)
-> 2271 return operations.invoke(op)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/operations/base.py:393, in AbstractOperations.invoke(self, operation)
386 \"\"\"Given a :class:`.MigrateOperation`, invoke it in terms of
387 this :class:`.Operations` instance.
388
389 \"\"\"
390 fn = self._to_impl.dispatch(
391 operation, self.migration_context.impl.__dialect__
392 )
--> 393 return fn(self, operation)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/operations/toimpl.py:89, in drop_column(operations, operation)
84 @Operations.implementation_for(ops.DropColumnOp)
85 def drop_column(
86 operations: \"Operations\", operation: \"ops.DropColumnOp\"
87 ) -> None:
88 column = operation.to_column(operations.migration_context)
---> 89 operations.impl.drop_column(
90 operation.table_name, column, schema=operation.schema, **operation.kw
91 )
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/ddl/impl.py:331, in DefaultImpl.drop_column(self, table_name, column, schema, **kw)
324 def drop_column(
325 self,
326 table_name: str,
(...)
329 **kw,
330 ) -> None:
--> 331 self._exec(base.DropColumn(table_name, column, schema=schema))
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/alembic/ddl/impl.py:193, in DefaultImpl._exec(self, construct, execution_options, multiparams, params)
190 assert isinstance(multiparams, tuple)
191 multiparams += (params,)
--> 193 return conn.execute( # type: ignore[call-overload]
194 construct, multiparams
195 )
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1380, in Connection.execute(self, statement, *multiparams, **params)
1376 util.raise_(
1377 exc.ObjectNotExecutableError(statement), replace_context=err
1378 )
1379 else:
-> 1380 return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py:80, in DDLElement._execute_on_connection(self, connection, multiparams, params, execution_options)
77 def _execute_on_connection(
78 self, connection, multiparams, params, execution_options
79 ):
---> 80 return connection._execute_ddl(
81 self, multiparams, params, execution_options
82 )
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1472, in Connection._execute_ddl(self, ddl, multiparams, params, execution_options)
1467 dialect = self.dialect
1469 compiled = ddl.compile(
1470 dialect=dialect, schema_translate_map=schema_translate_map
1471 )
-> 1472 ret = self._execute_context(
1473 dialect,
1474 dialect.execution_ctx_cls._init_ddl,
1475 compiled,
1476 None,
1477 execution_options,
1478 compiled,
1479 )
1480 if self._has_events or self.engine._has_events:
1481 self.dispatch.after_execute(
1482 self,
1483 ddl,
(...)
1487 ret,
1488 )
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1943, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
1940 branched.close()
1942 except BaseException as e:
-> 1943 self._handle_dbapi_exception(
1944 e, statement, parameters, cursor, context
1945 )
1947 return result
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/engine/base.py:2124, in Connection._handle_dbapi_exception(self, e, statement, parameters, cursor, context)
2122 util.raise_(newraise, with_traceback=exc_info[2], from_=e)
2123 elif should_wrap:
-> 2124 util.raise_(
2125 sqlalchemy_exception, with_traceback=exc_info[2], from_=e
2126 )
2127 else:
2128 util.raise_(exc_info[1], with_traceback=exc_info[2])
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/util/compat.py:208, in raise_(***failed resolving arguments***)
205 exception.__cause__ = replace_context
207 try:
--> 208 raise exception
209 finally:
210 # credit to
211 # https://cosmicpercolator.com/2016/01/13/exception-leaks-in-python-2-and-3/
212 # as the __traceback__ object creates a cycle
213 del exception, replace_context, from_, with_traceback
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/engine/base.py:1900, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
1898 break
1899 if not evt_handled:
-> 1900 self.dialect.do_execute(
1901 cursor, statement, parameters, context
1902 )
1904 if self._has_events or self.engine._has_events:
1905 self.dispatch.after_cursor_execute(
1906 self,
1907 cursor,
(...)
1911 context.executemany,
1912 )
File ~/.pyenv/versions/3.9.16/envs/encord_new_ui/lib/python3.9/site-packages/sqlalchemy/engine/default.py:736, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
735 def do_execute(self, cursor, statement, parameters, context=None):
--> 736 cursor.execute(statement, parameters)
OperationalError: (sqlite3.OperationalError) near \"DROP\": syntax error
[SQL: ALTER TABLE active_project_analytics_data DROP COLUMN metric_annotation_quality]
(Background on this error at: https://sqlalche.me/e/14/e3q8)"
}