Labelo Database Configuration
Labelo defaults to using SQLite, which is typically sufficient for projects involving up to tens of thousands of labeling tasks. However, if your project requires complex filtering in the data manager, involves many concurrent users, or handles large-scale real-world tasks with millions of entries, it is highly recommended to switch to a PostgreSQL database for improved performance, scalability, and efficiency.
When managing large datasets and multiple users accessing the platform simultaneously, PostgreSQL provides a more robust and reliable solution than SQLite, ensuring smoother operations and more efficient data handling.
SQLite
By default, Labelo uses SQLite as its database, which requires no additional setup. All data is stored in a single file located in the admin user’s specified directory. Once Labelo starts, the directory path where the data is stored is printed in the terminal for easy reference.
Postgresql
Alternatively, you can use PostgreSQL to store your tasks and annotations. This is especially advantageous if you expect to frequently import new labeling tasks or work on projects involving hundreds of thousands or even millions of tasks. PostgreSQL is a more scalable solution, capable of managing larger datasets and supporting complex multi-user workflows.
To connect Labelo to a PostgreSQL database, you need to set the following environment variables:
- DATABASE_NAME: The name of your PostgreSQL database.
- DATABASE_USER: The username required to access your PostgreSQL database.
- DATABASE_PASSWORD: The password associated with the specified PostgreSQL user.
- DATABASE_HOST: The host address where your PostgreSQL database is running (e.g.,
localhost
or a remote server IP). - DATABASE_PORT: The port used by PostgreSQL (default is typically
5432
).
Creating a Local Connection
If you're working locally and want to set up a PostgreSQL connection, run the following command to configure the environment variable within your Poetry environment:
poetry run export SET_DB=postgres
Once these environment variables are configured, Labelo will be able to connect to and store data in your PostgreSQL database.