Skip to content

Cannot use SQLite as the SQL registry #5565

Closed

Description

@oonisim

Expected Behavior

feature_store.yaml with SQLite as sql registry works.

project: my_project
# By default, the registry is a file (but can be turned into a more scalable SQL-backed registry)
# registry: data/registry.db     # <--- works with file registry but not with sqlite as sql registry.
registry:
  registry_type: sql
  path: sqlite:///data/registry.db
# The provider primarily specifies default offline / online stores & storing the registry in a given cloud
provider: local
offline_store:
  type: file
online_store:
    type: sqlite
    path: data/online_store.db
entity_key_serialization_version: 3
# By default, no_auth for authentication and authorization, other possible values kubernetes and oidc. Refer the documentation for more details.
auth:
    type: no_auth

Current Behavior

feature_store = FeatureStore(repo_path=".")
...
OperationalError: (sqlite3.OperationalError) database is locked
[SQL: INSERT INTO feast_metadata (project_id, metadata_key, metadata_value, last_updated_timestamp) VALUES (?, ?, ?, ?)]
[parameters: ('my_project', 'last_updated_timestamp', '1754965241', 1754965241)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)

Steps to reproduce

Create a project/repository structure.

my_project/feature_repo
├── data
│   └── driver_stats.parquet
├── example_repo.py
└── feature_store.yaml

Run.

feature_store = FeatureStore(repo_path=".")

example_repo.py:

# This is an example feature definition file

from datetime import timedelta

from feast import (
    Entity,
    FeatureService,
    FeatureView,
    Field,
    FileSource,
    Project,
)
from feast.feature_logging import LoggingConfig
from feast.infra.offline_stores.file_source import FileLoggingDestination
from feast.types import Float32, Int64

project = Project(name="my_project", description="A project for driver statistics")

driver_hourly_stats = FileSource(
    name="driver_hourly_stats_source",
    path="data/driver_stats.parquet",
    timestamp_field="event_timestamp",
    created_timestamp_column="created",
)

# You can think of an entity as a primary key used to fetch features.
driver = Entity(name="driver", join_keys=["driver_id"])

driver_hourly_stats_view = FeatureView(
    name="driver_hourly_stats",
    entities=[driver],
    ttl=timedelta(days=1),
    # The list of features defined below act as a schema to both define features
    # for both materialization of features into a store, and are used as references
    # during retrieval for building a training dataset or serving features
    schema=[
        Field(name="conv_rate", dtype=Float32),
        Field(name="acc_rate", dtype=Float32),
        Field(name="avg_daily_trips", dtype=Int64, description="Average daily trips"),
    ],
    # Tell FEAST to materialise into online store.
    online=True,
    source=driver_hourly_stats,           # <--- Link to the raw data storage technology
    tags={"team": "driver_performance"},
)

# This groups features into a model version
driver_activity_v1 = FeatureService(
    name="driver_activity_v1",
    features=[
        # driver_hourly_stats_view[["conv_rate", "acc_rate"]],  # Sub-selects a feature from a feature view
        driver_hourly_stats_view,
    ],
    logging_config=LoggingConfig(
        destination=FileLoggingDestination(path="data")
    ),
)

Specifications

  • Version:
import feast
feast.__version__

'0.51.0'
  • Platform: MacOS M2 (15.5 (24F74))
  • Subsystem: Python 3.11

Possible Solution

Activity

  1. oonisim commented on Aug 12, 2025

    @oonisim
    Author

    Full stack trace.

    ---------------------------------------------------------------------------
    OperationalError                          Traceback (most recent call last)
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1961, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1960     if not evt_handled:
    -> 1961         self.dialect.do_execute(
       1962             cursor, str_statement, effective_parameters, context
       1963         )
       1965 if self._has_events or self.engine._has_events:
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/default.py:944, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
        943 def do_execute(self, cursor, statement, parameters, context=None):
    --> 944     cursor.execute(statement, parameters)
    
    OperationalError: database is locked
    
    The above exception was the direct cause of the following exception:
    
    OperationalError                          Traceback (most recent call last)
    Cell In[12], line 1
    ----> 1 feature_store = FeatureStore(repo_path=".")
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/feature_store.py:158, in FeatureStore.__init__(self, repo_path, config, fs_yaml_file)
        156 registry_config = self.config.registry
        157 if registry_config.registry_type == "sql":
    --> 158     self._registry = SqlRegistry(registry_config, self.config.project, None)
        159 elif registry_config.registry_type == "snowflake.registry":
        160     from feast.infra.registry.snowflake import SnowflakeRegistry
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:274, in SqlRegistry.__init__(self, registry_config, project, repo_path)
        270 self.purge_feast_metadata = registry_config.purge_feast_metadata
        271 # Sync feast_metadata to projects table
        272 # when purge_feast_metadata is set to True, Delete data from
        273 # feast_metadata table and list_project_metadata will not return any data
    --> 274 self._sync_feast_metadata_to_projects_table()
        275 if not self.purge_feast_metadata:
        276     self._maybe_init_project_metadata(project)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:306, in SqlRegistry._sync_feast_metadata_to_projects_table(self)
        304 projects_to_sync = set(feast_metadata_projects.keys()) - set(projects_set)
        305 for project_name in projects_to_sync:
    --> 306     self.apply_project(
        307         Project(
        308             name=project_name,
        309             created_timestamp=datetime.fromtimestamp(
        310                 feast_metadata_projects[project_name], tz=timezone.utc
        311             ),
        312         ),
        313         commit=True,
        314     )
        316 if self.purge_feast_metadata:
        317     with self.write_engine.begin() as conn:
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1241, in SqlRegistry.apply_project(self, project, commit)
       1236 def apply_project(
       1237     self,
       1238     project: Project,
       1239     commit: bool = True,
       1240 ):
    -> 1241     return self._apply_object(
       1242         projects, project.name, "project_name", project, "project_proto"
       1243     )
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1021, in SqlRegistry._apply_object(self, table, project, id_field_name, obj, proto_field_name, name)
       1017     self.apply_project(
       1018         self.get_project(name=project, allow_cache=False), commit=True
       1019     )
       1020 if not self.purge_feast_metadata:
    -> 1021     self._set_last_updated_metadata(update_datetime, project)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1146, in SqlRegistry._set_last_updated_metadata(self, last_updated, project)
       1142 else:
       1143     insert_stmt = insert(feast_metadata).values(
       1144         values,
       1145     )
    -> 1146     conn.execute(insert_stmt)
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1413, in Connection.execute(self, statement, parameters, execution_options)
       1411     raise exc.ObjectNotExecutableError(statement) from err
       1412 else:
    -> 1413     return meth(
       1414         self,
       1415         distilled_parameters,
       1416         execution_options or NO_OPTIONS,
       1417     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/sql/elements.py:526, in ClauseElement._execute_on_connection(self, connection, distilled_params, execution_options)
        524     if TYPE_CHECKING:
        525         assert isinstance(self, Executable)
    --> 526     return connection._execute_clauseelement(
        527         self, distilled_params, execution_options
        528     )
        529 else:
        530     raise exc.ObjectNotExecutableError(self)
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1635, in Connection._execute_clauseelement(self, elem, distilled_parameters, execution_options)
       1623 compiled_cache: Optional[CompiledCacheType] = execution_options.get(
       1624     "compiled_cache", self.engine._compiled_cache
       1625 )
       1627 compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
       1628     dialect=dialect,
       1629     compiled_cache=compiled_cache,
       (...)   1633     linting=self.dialect.compiler_linting | compiler.WARN_LINTING,
       1634 )
    -> 1635 ret = self._execute_context(
       1636     dialect,
       1637     dialect.execution_ctx_cls._init_compiled,
       1638     compiled_sql,
       1639     distilled_parameters,
       1640     execution_options,
       1641     compiled_sql,
       1642     distilled_parameters,
       1643     elem,
       1644     extracted_params,
       1645     cache_hit=cache_hit,
       1646 )
       1647 if has_events:
       1648     self.dispatch.after_execute(
       1649         self,
       1650         elem,
       (...)   1654         ret,
       1655     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1840, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
       1838     return self._exec_insertmany_context(dialect, context)
       1839 else:
    -> 1840     return self._exec_single_context(
       1841         dialect, context, statement, parameters
       1842     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1980, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1977     result = context._setup_result_proxy()
       1979 except BaseException as e:
    -> 1980     self._handle_dbapi_exception(
       1981         e, str_statement, effective_parameters, cursor, context
       1982     )
       1984 return result
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2349, in Connection._handle_dbapi_exception(self, e, statement, parameters, cursor, context, is_sub_exec)
       2347 elif should_wrap:
       2348     assert sqlalchemy_exception is not None
    -> 2349     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
       2350 else:
       2351     assert exc_info[1] is not None
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1961, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1959                 break
       1960     if not evt_handled:
    -> 1961         self.dialect.do_execute(
       1962             cursor, str_statement, effective_parameters, context
       1963         )
       1965 if self._has_events or self.engine._has_events:
       1966     self.dispatch.after_cursor_execute(
       1967         self,
       1968         cursor,
       (...)   1972         context.executemany,
       1973     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/default.py:944, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
        943 def do_execute(self, cursor, statement, parameters, context=None):
    --> 944     cursor.execute(statement, parameters)
    
    OperationalError: (sqlite3.OperationalError) database is locked
    [SQL: INSERT INTO feast_metadata (project_id, metadata_key, metadata_value, last_updated_timestamp) VALUES (?, ?, ?, ?)]
    [parameters: ('my_project', 'last_updated_timestamp', '1754965241', 1754965241)]
    (Background on this error at: https://sqlalche.me/e/20/e3q8)
    
  2. oonisim commented on Aug 12, 2025

    @oonisim
    Author

    SDK without feature_store.yaml cause the same.

    import subprocess
    from datetime import (
        datetime,
        timedelta
    )
    
    import pandas as pd
    import sqlite3
    from feast import (
        Entity,
        FeatureService,
        FeatureView,
        Field,
        FileSource,
        Project,
        PushSource,
        RequestSource,
        RepoConfig,
    )
    from feast.repo_config import (
        RegistryConfig
    )
    from feast.feature_logging import LoggingConfig
    from feast.infra.offline_stores.file_source import FileLoggingDestination
    from feast.infra.online_stores.sqlite import (
        SqliteOnlineStoreConfig
    )
    from feast.infra.registry.sql import (
        SqlRegistryConfig
    )
    from feast.on_demand_feature_view import on_demand_feature_view
    from feast.types import (
        Float32, Float64, Int64
    )
    from feast.value_type import (
        ValueType
    )
    from feast import FeatureStore
    from feast.data_source import PushMode
    
    pd.set_option('display.max_columns', None)
    pd.set_option('display.max_rows', None)
    
    repo_config = RepoConfig(
        #registry=RegistryConfig(path="data/registry.db"),
        registry=SqlRegistryConfig(path="sqlite:///data/registry.db", registry_type="sql"),
        project="my_project",
        provider="local",
        offline_store="file",  # Could also be the OfflineStoreConfig e.g. FileOfflineStoreConfig
        online_store=SqliteOnlineStoreConfig(path='data/online_store.db')
    )
    
    driver_hourly_stats = FileSource(
        name="driver_hourly_stats_source",
        path="data/driver_stats.parquet",
        timestamp_field="event_timestamp",
        created_timestamp_column="created",
    )
    
    driver = Entity(name="driver", join_keys=["driver_id"], value_type=ValueType.INT64)
    driver_hourly_stats_view = FeatureView(
        name="driver_hourly_stats",
        entities=[driver],
        ttl=timedelta(days=1),
        schema=[
            Field(name="conv_rate", dtype=Float32),
            Field(name="acc_rate", dtype=Float32),
            Field(name="avg_daily_trips", dtype=Int64, description="Average daily trips"),
        ],
        online=True,
        source=driver_hourly_stats,           # <--- Link to the raw data storage technology
        tags={"team": "driver_performance"},
    )
    
    driver_activity_fs_v1 = FeatureService(
        name="driver_activity_v1",
        features=[
            # driver_hourly_stats_view[["conv_rate", "acc_rate"]],  # Sub-selects a feature from a feature view
            driver_hourly_stats_view,
        ],
        logging_config=LoggingConfig(
            destination=FileLoggingDestination(path="data")
        ),
    )
    
    feature_store = FeatureStore(config=repo_config)
    feature_store.apply(objects=[
        driver_hourly_stats,       # Data source
        driver,                    # Entity
        driver_hourly_stats_view,  # Feature View
        driver_activity_fs_v1      # Feature Service
    ])
    
    ---------------------------------------------------------------------------
    OperationalError                          Traceback (most recent call last)
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1961, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1960     if not evt_handled:
    -> 1961         self.dialect.do_execute(
       1962             cursor, str_statement, effective_parameters, context
       1963         )
       1965 if self._has_events or self.engine._has_events:
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/default.py:944, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
        943 def do_execute(self, cursor, statement, parameters, context=None):
    --> 944     cursor.execute(statement, parameters)
    
    OperationalError: database is locked
    
    The above exception was the direct cause of the following exception:
    
    OperationalError                          Traceback (most recent call last)
    Cell In[12], line 1
    ----> 1 feature_store = FeatureStore(config=repo_config)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/feature_store.py:158, in FeatureStore.__init__(self, repo_path, config, fs_yaml_file)
        156 registry_config = self.config.registry
        157 if registry_config.registry_type == "sql":
    --> 158     self._registry = SqlRegistry(registry_config, self.config.project, None)
        159 elif registry_config.registry_type == "snowflake.registry":
        160     from feast.infra.registry.snowflake import SnowflakeRegistry
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:274, in SqlRegistry.__init__(self, registry_config, project, repo_path)
        270 self.purge_feast_metadata = registry_config.purge_feast_metadata
        271 # Sync feast_metadata to projects table
        272 # when purge_feast_metadata is set to True, Delete data from
        273 # feast_metadata table and list_project_metadata will not return any data
    --> 274 self._sync_feast_metadata_to_projects_table()
        275 if not self.purge_feast_metadata:
        276     self._maybe_init_project_metadata(project)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:306, in SqlRegistry._sync_feast_metadata_to_projects_table(self)
        304 projects_to_sync = set(feast_metadata_projects.keys()) - set(projects_set)
        305 for project_name in projects_to_sync:
    --> 306     self.apply_project(
        307         Project(
        308             name=project_name,
        309             created_timestamp=datetime.fromtimestamp(
        310                 feast_metadata_projects[project_name], tz=timezone.utc
        311             ),
        312         ),
        313         commit=True,
        314     )
        316 if self.purge_feast_metadata:
        317     with self.write_engine.begin() as conn:
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1241, in SqlRegistry.apply_project(self, project, commit)
       1236 def apply_project(
       1237     self,
       1238     project: Project,
       1239     commit: bool = True,
       1240 ):
    -> 1241     return self._apply_object(
       1242         projects, project.name, "project_name", project, "project_proto"
       1243     )
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1021, in SqlRegistry._apply_object(self, table, project, id_field_name, obj, proto_field_name, name)
       1017     self.apply_project(
       1018         self.get_project(name=project, allow_cache=False), commit=True
       1019     )
       1020 if not self.purge_feast_metadata:
    -> 1021     self._set_last_updated_metadata(update_datetime, project)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1146, in SqlRegistry._set_last_updated_metadata(self, last_updated, project)
       1142 else:
       1143     insert_stmt = insert(feast_metadata).values(
       1144         values,
       1145     )
    -> 1146     conn.execute(insert_stmt)
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1413, in Connection.execute(self, statement, parameters, execution_options)
       1411     raise exc.ObjectNotExecutableError(statement) from err
       1412 else:
    -> 1413     return meth(
       1414         self,
       1415         distilled_parameters,
       1416         execution_options or NO_OPTIONS,
       1417     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/sql/elements.py:526, in ClauseElement._execute_on_connection(self, connection, distilled_params, execution_options)
        524     if TYPE_CHECKING:
        525         assert isinstance(self, Executable)
    --> 526     return connection._execute_clauseelement(
        527         self, distilled_params, execution_options
        528     )
        529 else:
        530     raise exc.ObjectNotExecutableError(self)
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1635, in Connection._execute_clauseelement(self, elem, distilled_parameters, execution_options)
       1623 compiled_cache: Optional[CompiledCacheType] = execution_options.get(
       1624     "compiled_cache", self.engine._compiled_cache
       1625 )
       1627 compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
       1628     dialect=dialect,
       1629     compiled_cache=compiled_cache,
       (...)   1633     linting=self.dialect.compiler_linting | compiler.WARN_LINTING,
       1634 )
    -> 1635 ret = self._execute_context(
       1636     dialect,
       1637     dialect.execution_ctx_cls._init_compiled,
       1638     compiled_sql,
       1639     distilled_parameters,
       1640     execution_options,
       1641     compiled_sql,
       1642     distilled_parameters,
       1643     elem,
       1644     extracted_params,
       1645     cache_hit=cache_hit,
       1646 )
       1647 if has_events:
       1648     self.dispatch.after_execute(
       1649         self,
       1650         elem,
       (...)   1654         ret,
       1655     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1840, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
       1838     return self._exec_insertmany_context(dialect, context)
       1839 else:
    -> 1840     return self._exec_single_context(
       1841         dialect, context, statement, parameters
       1842     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1980, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1977     result = context._setup_result_proxy()
       1979 except BaseException as e:
    -> 1980     self._handle_dbapi_exception(
       1981         e, str_statement, effective_parameters, cursor, context
       1982     )
       1984 return result
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2349, in Connection._handle_dbapi_exception(self, e, statement, parameters, cursor, context, is_sub_exec)
       2347 elif should_wrap:
       2348     assert sqlalchemy_exception is not None
    -> 2349     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
       2350 else:
       2351     assert exc_info[1] is not None
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1961, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1959                 break
       1960     if not evt_handled:
    -> 1961         self.dialect.do_execute(
       1962             cursor, str_statement, effective_parameters, context
       1963         )
       1965 if self._has_events or self.engine._has_events:
       1966     self.dispatch.after_cursor_execute(
       1967         self,
       1968         cursor,
       (...)   1972         context.executemany,
       1973     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/default.py:944, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
        943 def do_execute(self, cursor, statement, parameters, context=None):
    --> 944     cursor.execute(statement, parameters)
    
    OperationalError: (sqlite3.OperationalError) database is locked
    [SQL: INSERT INTO feast_metadata (project_id, metadata_key, metadata_value, last_updated_timestamp) VALUES (?, ?, ?, ?)]
    [parameters: ('my_project', 'last_updated_timestamp', '1754966314', 1754966314)]
    (Background on this error at: https://sqlalche.me/e/20/e3q8)
    
  3. ntkathole commented on Aug 12, 2025

    @ntkathole
    Member

    @oonisim This looks like concurrency issue at database level. Can you try to configure registry with

    registry=SqlRegistryConfig(
            path="sqlite:///data/registry.db", 
            registry_type="sql",
            sqlalchemy_config_kwargs={
                "connect_args": {
                    "timeout": 30,  # 30 second timeout instead of immediate failure
                    "check_same_thread": False  # Allow multi-threading
                }
            }
        ),
    
  4. oonisim commented on Aug 18, 2025

    @oonisim
    Author

    @ntkathole thanks for the reply. Tried the suggestion but no luck.

    @oonisim This looks like concurrency issue at database level. Can you try to configure registry with

    registry=SqlRegistryConfig(
            path="sqlite:///data/registry.db", 
            registry_type="sql",
            sqlalchemy_config_kwargs={
                "connect_args": {
                    "timeout": 30,  # 30 second timeout instead of immediate failure
                    "check_same_thread": False  # Allow multi-threading
                }
            }
        ),
    
    ---------------------------------------------------------------------------
    ProjectObjectNotFoundException            Traceback (most recent call last)
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:909, in SqlRegistry._initialize_project_if_not_exists(self, project_name)
        908 try:
    --> 909     self.get_project(project_name, allow_cache=True)
        910     return
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/caching_registry.py:410, in CachingRegistry.get_project(self, name, allow_cache)
        409     self._refresh_cached_registry_if_necessary()
    --> 410     return proto_registry_utils.get_project(self.cached_registry_proto, name)
        411 return self._get_project(name)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/proto_registry_utils.py:395, in get_project(registry_proto, name)
        394         return Project.from_proto(projects_proto)
    --> 395 raise ProjectObjectNotFoundException(name=name)
    
    ProjectObjectNotFoundException: Project my_project does not exist
    
    During handling of the above exception, another exception occurred:
    
    ProjectObjectNotFoundException            Traceback (most recent call last)
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:913, in SqlRegistry._initialize_project_if_not_exists(self, project_name)
        912 try:
    --> 913     self.get_project(project_name, allow_cache=False)
        914     return
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/caching_registry.py:411, in CachingRegistry.get_project(self, name, allow_cache)
        410     return proto_registry_utils.get_project(self.cached_registry_proto, name)
    --> 411 return self._get_project(name)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1225, in SqlRegistry._get_project(self, name)
       1221 def _get_project(
       1222     self,
       1223     name: str,
       1224 ) -> Project:
    -> 1225     return self._get_object(
       1226         table=projects,
       1227         name=name,
       1228         project=name,
       1229         proto_class=ProjectProto,
       1230         python_class=Project,
       1231         id_field_name="project_name",
       1232         proto_field_name="project_proto",
       1233         not_found_exception=ProjectObjectNotFoundException,
       1234     )
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1087, in SqlRegistry._get_object(self, table, name, project, proto_class, python_class, id_field_name, proto_field_name, not_found_exception)
       1086 if not_found_exception:
    -> 1087     raise not_found_exception(name, project)
       1088 else:
    
    ProjectObjectNotFoundException: Project my_project does not exist
    
    During handling of the above exception, another exception occurred:
    
    OperationalError                          Traceback (most recent call last)
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1961, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1960     if not evt_handled:
    -> 1961         self.dialect.do_execute(
       1962             cursor, str_statement, effective_parameters, context
       1963         )
       1965 if self._has_events or self.engine._has_events:
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/default.py:944, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
        943 def do_execute(self, cursor, statement, parameters, context=None):
    --> 944     cursor.execute(statement, parameters)
    
    OperationalError: database is locked
    
    The above exception was the direct cause of the following exception:
    
    OperationalError                          Traceback (most recent call last)
    Cell In[16], line 1
    ----> 1 feature_store.apply(objects=[
          2     driver_hourly_stats,       # Data source
          3     driver,                    # Entity
          4     driver_hourly_stats_view,  # Feature View
          5     driver_activity_fs_v1      # Feature Service
          6 ])
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/feature_store.py:971, in FeatureStore.apply(self, objects, objects_to_delete, partial)
        969     self._registry.apply_project(project, commit=False)
        970 for ds in data_sources_to_update:
    --> 971     self._registry.apply_data_source(ds, project=self.project, commit=False)
        972 for view in itertools.chain(views_to_update, odfvs_to_update, sfvs_to_update):
        973     self._registry.apply_feature_view(view, project=self.project, commit=False)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:574, in SqlRegistry.apply_data_source(self, data_source, project, commit)
        571 def apply_data_source(
        572     self, data_source: DataSource, project: str, commit: bool = True
        573 ):
    --> 574     return self._apply_object(
        575         data_sources, project, "data_source_name", data_source, "data_source_proto"
        576     )
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:931, in SqlRegistry._apply_object(self, table, project, id_field_name, obj, proto_field_name, name)
        929 # Initialize project is necessary because FeatureStore object can apply objects individually without "feast apply" cli option
        930 if not isinstance(obj, Project):
    --> 931     self._initialize_project_if_not_exists(project_name=project)
        932 name = name or (obj.name if hasattr(obj, "name") else None)
        933 assert name, f"name needs to be provided for {obj}"
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:916, in SqlRegistry._initialize_project_if_not_exists(self, project_name)
        914     return
        915 except ProjectObjectNotFoundException:
    --> 916     self.apply_project(Project(name=project_name), commit=True)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1241, in SqlRegistry.apply_project(self, project, commit)
       1236 def apply_project(
       1237     self,
       1238     project: Project,
       1239     commit: bool = True,
       1240 ):
    -> 1241     return self._apply_object(
       1242         projects, project.name, "project_name", project, "project_proto"
       1243     )
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1021, in SqlRegistry._apply_object(self, table, project, id_field_name, obj, proto_field_name, name)
       1017     self.apply_project(
       1018         self.get_project(name=project, allow_cache=False), commit=True
       1019     )
       1020 if not self.purge_feast_metadata:
    -> 1021     self._set_last_updated_metadata(update_datetime, project)
    
    File ~/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py:1146, in SqlRegistry._set_last_updated_metadata(self, last_updated, project)
       1142 else:
       1143     insert_stmt = insert(feast_metadata).values(
       1144         values,
       1145     )
    -> 1146     conn.execute(insert_stmt)
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1413, in Connection.execute(self, statement, parameters, execution_options)
       1411     raise exc.ObjectNotExecutableError(statement) from err
       1412 else:
    -> 1413     return meth(
       1414         self,
       1415         distilled_parameters,
       1416         execution_options or NO_OPTIONS,
       1417     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/sql/elements.py:526, in ClauseElement._execute_on_connection(self, connection, distilled_params, execution_options)
        524     if TYPE_CHECKING:
        525         assert isinstance(self, Executable)
    --> 526     return connection._execute_clauseelement(
        527         self, distilled_params, execution_options
        528     )
        529 else:
        530     raise exc.ObjectNotExecutableError(self)
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1635, in Connection._execute_clauseelement(self, elem, distilled_parameters, execution_options)
       1623 compiled_cache: Optional[CompiledCacheType] = execution_options.get(
       1624     "compiled_cache", self.engine._compiled_cache
       1625 )
       1627 compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
       1628     dialect=dialect,
       1629     compiled_cache=compiled_cache,
       (...)   1633     linting=self.dialect.compiler_linting | compiler.WARN_LINTING,
       1634 )
    -> 1635 ret = self._execute_context(
       1636     dialect,
       1637     dialect.execution_ctx_cls._init_compiled,
       1638     compiled_sql,
       1639     distilled_parameters,
       1640     execution_options,
       1641     compiled_sql,
       1642     distilled_parameters,
       1643     elem,
       1644     extracted_params,
       1645     cache_hit=cache_hit,
       1646 )
       1647 if has_events:
       1648     self.dispatch.after_execute(
       1649         self,
       1650         elem,
       (...)   1654         ret,
       1655     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1840, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
       1838     return self._exec_insertmany_context(dialect, context)
       1839 else:
    -> 1840     return self._exec_single_context(
       1841         dialect, context, statement, parameters
       1842     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1980, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1977     result = context._setup_result_proxy()
       1979 except BaseException as e:
    -> 1980     self._handle_dbapi_exception(
       1981         e, str_statement, effective_parameters, cursor, context
       1982     )
       1984 return result
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:2349, in Connection._handle_dbapi_exception(self, e, statement, parameters, cursor, context, is_sub_exec)
       2347 elif should_wrap:
       2348     assert sqlalchemy_exception is not None
    -> 2349     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
       2350 else:
       2351     assert exc_info[1] is not None
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py:1961, in Connection._exec_single_context(self, dialect, context, statement, parameters)
       1959                 break
       1960     if not evt_handled:
    -> 1961         self.dialect.do_execute(
       1962             cursor, str_statement, effective_parameters, context
       1963         )
       1965 if self._has_events or self.engine._has_events:
       1966     self.dispatch.after_cursor_execute(
       1967         self,
       1968         cursor,
       (...)   1972         context.executemany,
       1973     )
    
    File ~/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/default.py:944, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
        943 def do_execute(self, cursor, statement, parameters, context=None):
    --> 944     cursor.execute(statement, parameters)
    
    OperationalError: (sqlite3.OperationalError) database is locked
    [SQL: INSERT INTO feast_metadata (project_id, metadata_key, metadata_value, last_updated_timestamp) VALUES (?, ?, ?, ?)]
    [parameters: ('my_project', 'last_updated_timestamp', '1755478490', 1755478490)]
    (Background on this error at: https://sqlalche.me/e/20/e3q8)
    
  5. oonisim commented on Sep 1, 2025

    @oonisim
    Author

    The documentation says Sqlite works as the SQL Registry DB. But it is not working with FEAST 0.51.
    Please verify if SQLite does work or update the document if it does not work.

    https://docs.feast.dev/reference/registries/sql

    Image
  6. oonisim commented on Sep 1, 2025

    @oonisim
    Author
    project: my_project
    # By default, the registry is a file (but can be turned into a more scalable SQL-backed registry)
    # registry: data/registry.db
    # SQLite SQL Registry does not work.
    # https://github.com/feast-dev/feast/issues/5565
    registry:
      registry_type: sql
      path: sqlite:///data/registry.db
      # SQLAlchemy Configuration advised at github.com/feast-dev/feast/issues/5565
      # Did not work:
      # sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
      # [SQL: INSERT INTO feast_metadata (project_id, metadata_key, metadata_value, last_updated_timestamp) VALUES (?, ?, ?, ?)]
      # [parameters: ('my_project', 'last_updated_timestamp', '1756687000', 1756687000)]
      sqlalchemy_config_kwargs:
        echo: True
        connect_args:
          timeout: 30
          check_same_thread: False
    
    # The provider primarily specifies default offline / online stores & storing the registry in a given cloud
    provider: local
    offline_store:
      type: file
    online_store:
      type: sqlite
      path: data/online_store.db
    entity_key_serialization_version: 3
    # By default, no_auth for authentication and authorization, other possible values kubernetes and oidc. Refer the documentation for more details.
    auth:
      type: no_auth
    
    $ feast apply
    Empty database file created: registry.db
    feast/my_project/feature_repo/example_repo.py:27: DeprecationWarning: Entity value_type will be mandatory in the next release. Please specify a value_type for entity 'driver'.
      driver = Entity(name="driver", join_keys=["driver_id"])
    2025-09-01 10:54:06,773 INFO sqlalchemy.engine.Engine BEGIN (implicit)
    INFO:sqlalchemy.engine.Engine:BEGIN (implicit)
    2025-09-01 10:54:06,773 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("projects")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("projects")
    2025-09-01 10:54:06,773 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,775 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("entities")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("entities")
    2025-09-01 10:54:06,776 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,776 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("data_sources")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("data_sources")
    2025-09-01 10:54:06,776 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,777 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("feature_views")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("feature_views")
    2025-09-01 10:54:06,777 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,777 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("stream_feature_views")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("stream_feature_views")
    2025-09-01 10:54:06,777 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,777 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("on_demand_feature_views")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("on_demand_feature_views")
    2025-09-01 10:54:06,778 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,778 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("feature_services")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("feature_services")
    2025-09-01 10:54:06,778 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,778 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("saved_datasets")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("saved_datasets")
    2025-09-01 10:54:06,778 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,778 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("validation_references")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("validation_references")
    2025-09-01 10:54:06,779 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,779 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("managed_infra")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("managed_infra")
    2025-09-01 10:54:06,779 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,779 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("permissions")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("permissions")
    2025-09-01 10:54:06,779 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,779 INFO sqlalchemy.engine.Engine PRAGMA main.table_info("feast_metadata")
    INFO:sqlalchemy.engine.Engine:PRAGMA main.table_info("feast_metadata")
    2025-09-01 10:54:06,779 INFO sqlalchemy.engine.Engine [raw sql] ()
    INFO:sqlalchemy.engine.Engine:[raw sql] ()
    2025-09-01 10:54:06,780 INFO sqlalchemy.engine.Engine COMMIT
    INFO:sqlalchemy.engine.Engine:COMMIT
    2025-09-01 10:54:06,780 INFO sqlalchemy.engine.Engine BEGIN (implicit)
    INFO:sqlalchemy.engine.Engine:BEGIN (implicit)
    2025-09-01 10:54:06,783 INFO sqlalchemy.engine.Engine SELECT feast_metadata.project_id, feast_metadata.metadata_key, feast_metadata.metadata_value, feast_metadata.last_updated_timestamp 
    FROM feast_metadata 
    WHERE feast_metadata.metadata_key = ?
    INFO:sqlalchemy.engine.Engine:SELECT feast_metadata.project_id, feast_metadata.metadata_key, feast_metadata.metadata_value, feast_metadata.last_updated_timestamp 
    FROM feast_metadata 
    WHERE feast_metadata.metadata_key = ?
    2025-09-01 10:54:06,783 INFO sqlalchemy.engine.Engine [generated in 0.00018s] ('project_uuid',)
    INFO:sqlalchemy.engine.Engine:[generated in 0.00018s] ('project_uuid',)
    2025-09-01 10:54:06,783 INFO sqlalchemy.engine.Engine COMMIT
    INFO:sqlalchemy.engine.Engine:COMMIT
    2025-09-01 10:54:06,784 INFO sqlalchemy.engine.Engine BEGIN (implicit)
    INFO:sqlalchemy.engine.Engine:BEGIN (implicit)
    2025-09-01 10:54:06,784 INFO sqlalchemy.engine.Engine SELECT projects.project_id, projects.project_name, projects.last_updated_timestamp, projects.project_proto 
    FROM projects
    INFO:sqlalchemy.engine.Engine:SELECT projects.project_id, projects.project_name, projects.last_updated_timestamp, projects.project_proto 
    FROM projects
    2025-09-01 10:54:06,784 INFO sqlalchemy.engine.Engine [generated in 0.00012s] ()
    INFO:sqlalchemy.engine.Engine:[generated in 0.00012s] ()
    2025-09-01 10:54:06,785 INFO sqlalchemy.engine.Engine COMMIT
    INFO:sqlalchemy.engine.Engine:COMMIT
    2025-09-01 10:54:06,785 INFO sqlalchemy.engine.Engine BEGIN (implicit)
    INFO:sqlalchemy.engine.Engine:BEGIN (implicit)
    2025-09-01 10:54:06,786 INFO sqlalchemy.engine.Engine SELECT feast_metadata.project_id, feast_metadata.metadata_key, feast_metadata.metadata_value, feast_metadata.last_updated_timestamp 
    FROM feast_metadata 
    WHERE feast_metadata.metadata_key = ? AND feast_metadata.project_id = ?
    INFO:sqlalchemy.engine.Engine:SELECT feast_metadata.project_id, feast_metadata.metadata_key, feast_metadata.metadata_value, feast_metadata.last_updated_timestamp 
    FROM feast_metadata 
    WHERE feast_metadata.metadata_key = ? AND feast_metadata.project_id = ?
    2025-09-01 10:54:06,786 INFO sqlalchemy.engine.Engine [generated in 0.00015s] ('project_uuid', 'my_project')
    INFO:sqlalchemy.engine.Engine:[generated in 0.00015s] ('project_uuid', 'my_project')
    2025-09-01 10:54:06,786 INFO sqlalchemy.engine.Engine COMMIT
    INFO:sqlalchemy.engine.Engine:COMMIT
    2025-09-01 10:54:06,786 INFO sqlalchemy.engine.Engine BEGIN (implicit)
    INFO:sqlalchemy.engine.Engine:BEGIN (implicit)
    2025-09-01 10:54:06,787 INFO sqlalchemy.engine.Engine SELECT projects.project_id, projects.project_name, projects.last_updated_timestamp, projects.project_proto 
    FROM projects 
    WHERE projects.project_name = ? AND projects.project_id = ?
    INFO:sqlalchemy.engine.Engine:SELECT projects.project_id, projects.project_name, projects.last_updated_timestamp, projects.project_proto 
    FROM projects 
    WHERE projects.project_name = ? AND projects.project_id = ?
    2025-09-01 10:54:06,787 INFO sqlalchemy.engine.Engine [generated in 0.00012s] ('my_project', 'my_project')
    INFO:sqlalchemy.engine.Engine:[generated in 0.00012s] ('my_project', 'my_project')
    2025-09-01 10:54:06,788 INFO sqlalchemy.engine.Engine INSERT INTO projects (project_id, project_name, last_updated_timestamp, project_proto) VALUES (?, ?, ?, ?)
    INFO:sqlalchemy.engine.Engine:INSERT INTO projects (project_id, project_name, last_updated_timestamp, project_proto) VALUES (?, ?, ?, ?)
    2025-09-01 10:54:06,788 INFO sqlalchemy.engine.Engine [generated in 0.00015s] ('my_project', 'my_project', 1756688046, <memory at 0x1255ca800>)
    INFO:sqlalchemy.engine.Engine:[generated in 0.00015s] ('my_project', 'my_project', 1756688046, <memory at 0x1255ca800>)
    2025-09-01 10:54:06,790 INFO sqlalchemy.engine.Engine BEGIN (implicit)
    INFO:sqlalchemy.engine.Engine:BEGIN (implicit)
    2025-09-01 10:54:06,791 INFO sqlalchemy.engine.Engine SELECT feast_metadata.project_id, feast_metadata.metadata_key, feast_metadata.metadata_value, feast_metadata.last_updated_timestamp 
    FROM feast_metadata 
    WHERE feast_metadata.metadata_key = ? AND feast_metadata.project_id = ?
    INFO:sqlalchemy.engine.Engine:SELECT feast_metadata.project_id, feast_metadata.metadata_key, feast_metadata.metadata_value, feast_metadata.last_updated_timestamp 
    FROM feast_metadata 
    WHERE feast_metadata.metadata_key = ? AND feast_metadata.project_id = ?
    2025-09-01 10:54:06,791 INFO sqlalchemy.engine.Engine [cached since 0.005572s ago] ('last_updated_timestamp', 'my_project')
    INFO:sqlalchemy.engine.Engine:[cached since 0.005572s ago] ('last_updated_timestamp', 'my_project')
    2025-09-01 10:54:06,792 INFO sqlalchemy.engine.Engine INSERT INTO feast_metadata (project_id, metadata_key, metadata_value, last_updated_timestamp) VALUES (?, ?, ?, ?)
    INFO:sqlalchemy.engine.Engine:INSERT INTO feast_metadata (project_id, metadata_key, metadata_value, last_updated_timestamp) VALUES (?, ?, ?, ?)
    2025-09-01 10:54:06,792 INFO sqlalchemy.engine.Engine [generated in 0.00016s] ('my_project', 'last_updated_timestamp', '1756688046', 1756688046)
    INFO:sqlalchemy.engine.Engine:[generated in 0.00016s] ('my_project', 'last_updated_timestamp', '1756688046', 1756688046)
    2025-09-01 10:54:37,857 INFO sqlalchemy.engine.Engine ROLLBACK
    INFO:sqlalchemy.engine.Engine:ROLLBACK
    2025-09-01 10:54:37,858 INFO sqlalchemy.engine.Engine ROLLBACK
    INFO:sqlalchemy.engine.Engine:ROLLBACK
    Traceback (most recent call last):
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1961, in _exec_single_context
        self.dialect.do_execute(
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 944, in do_execute
        cursor.execute(statement, parameters)
    sqlite3.OperationalError: database is locked
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "HOME/venv/feast/bin/feast", line 8, in <module>
        sys.exit(cli())
                 ^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/click/core.py", line 1442, in __call__
        return self.main(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/click/core.py", line 1363, in main
        rv = self.invoke(ctx)
             ^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/click/core.py", line 1830, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/click/core.py", line 1226, in invoke
        return ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/click/core.py", line 794, in invoke
        return callback(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/click/decorators.py", line 34, in new_func
        return f(get_current_context(), *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/cli/cli.py", line 272, in apply_total_command
        apply_total(repo_config, repo, skip_source_validation)
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/repo_operations.py", line 392, in apply_total
        repo = _get_repo_contents(repo_path, repo_config.project)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/repo_operations.py", line 244, in _get_repo_contents
        repo = parse_repo(repo_path)
               ^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/repo_operations.py", line 135, in parse_repo
        module = importlib.import_module(module_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/[email protected]/3.11.13/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 940, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "feast/my_project/feature_repo/list_features.py", line 3, in <module>
        store = FeatureStore(repo_path=".")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/feature_store.py", line 158, in __init__
        self._registry = SqlRegistry(registry_config, self.config.project, None)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py", line 274, in __init__
        self._sync_feast_metadata_to_projects_table()
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py", line 306, in _sync_feast_metadata_to_projects_table
        self.apply_project(
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py", line 1241, in apply_project
        return self._apply_object(
               ^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py", line 1021, in _apply_object
        self._set_last_updated_metadata(update_datetime, project)
      File "HOME/venv/feast/lib/python3.11/site-packages/feast/infra/registry/sql.py", line 1146, in _set_last_updated_metadata
        conn.execute(insert_stmt)
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1413, in execute
        return meth(
               ^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
        return connection._execute_clauseelement(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement
        ret = self._execute_context(
              ^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1840, in _execute_context
        return self._exec_single_context(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1980, in _exec_single_context
        self._handle_dbapi_exception(
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2349, in _handle_dbapi_exception
        raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1961, in _exec_single_context
        self.dialect.do_execute(
      File "HOME/venv/feast/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 944, in do_execute
        cursor.execute(statement, parameters)
    sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
    [SQL: INSERT INTO feast_metadata (project_id, metadata_key, metadata_value, last_updated_timestamp) VALUES (?, ?, ?, ?)]
    [parameters: ('my_project', 'last_updated_timestamp', '1756688046', 1756688046)]
    (Background on this error at: https://sqlalche.me/e/20/e3q8)
    
  7. ntkathole commented on Sep 1, 2025

    @ntkathole
    Member

    @oonisim Hey, I checked again and it looks like the problem with transaction handling within feast itself. The _set_last_updated_metadata method was being called from within the _apply_object method's transaction context, but _set_last_updated_metadata was trying to start its own transaction with self.write_engine.begin(). This created a nested transaction scenario that SQLite doesn't handle well.

    I am working on the fix.

  8. self-assigned this
    on Sep 1, 2025
  9. oonisim commented on Sep 2, 2025

    @oonisim
    Author

    Thanks @ntkathole, confirmed the fix. It worked (replacing site-packages/feast/infra/registry/sql.py)

    feast apply
    Empty database file created: registry.db
      driver = Entity(name="driver", join_keys=["driver_id"])
    Applying changes for project my_project
    Updated project my_project
    	description:  -> A project for driver statistics
    Created entity driver
    Created feature view driver_hourly_stats
    Created feature service driver_activity_v1
    
    Created sqlite table my_project_driver_hourly_stats
    
    $ sqlite3 data/registry.db 
    SQLite version 3.43.2 2023-10-10 13:08:14
    Enter ".help" for usage hints.
    sqlite> SELECT * FROM feature_views;
    driver_hourly_stats|my_project|1756781231||
    ?
    driver_hourly_statsdriver"
    	conv_rate"
    
    acc_rate"(
    avg_daily_trips"Average daily trips*
    teamdriver_performance??:event_timestamp*createdZata/driver_stats.parquet?1feast.infra.offline_stores.file_source.FileSource?driver_hourly_stats_source?
    ...
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions