> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DatabaseLocksConfig

<span id="atoti_jdbc.DatabaseLocksConfig" />

> atoti\_jdbc.DatabaseLocksConfig(<br />
>     \*,<br />
>     *polling\_interval*: [timedelta](https://docs.python.org/3/library/datetime.html#datetime.timedelta) = `datetime.timedelta(seconds=300)`,<br />
> )

The config for the database level locks of a user content storage.

When [`database_locks`](./atoti_jdbc.UserContentStorageConfig#atoti_jdbc.UserContentStorageConfig.database_locks) is `None`, the user content storage relies on locks scoped to the session’s JVM.
Such locks cannot prevent concurrent modifications made by the other sessions.
When several sessions share the same user content storage, database level locks must be used instead.

A session is not notified of the changes made by the other sessions, so it polls the database at a regular interval.

<Note>
  The database schema differs between the two kinds of locks.
  Database locks must therefore be enabled on a new user content storage.
  Enabling them on one created without them makes the session fail to start with a missing column error, leaving that storage unchanged.
</Note>

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> from datetime import timedelta
>>> from atoti_jdbc import DatabaseLocksConfig, UserContentStorageConfig
>>> config = UserContentStorageConfig(
...     "h2:/home/user/database/file/path;USER=username;PASSWORD=passwd",
...     database_locks=DatabaseLocksConfig(polling_interval=timedelta(minutes=10)),
... )
```

### Attributes

<h4 id="atoti_jdbc.DatabaseLocksConfig.polling_interval">
  *polling\_interval*
</h4>

How often the database is polled for changes made by other sessions.

Changes made by another session become visible after at most this duration.
