New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL support #1385
MySQL support #1385
Conversation
One key thing to note is that MySQL <8 does not support |
label_studio/tasks/migrations/0001_squashed_0041_taskcompletionhistory_was_cancelled.py
Outdated
Show resolved
Hide resolved
Maybe we have to limit MySQL versions >= 8 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move docker-compose.mysql.yml to deploy folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls ignore my previous requirement. From my side everything is ok, waiting for conclusion from dev team.
label_studio/tasks/migrations/0001_squashed_0041_taskcompletionhistory_was_cancelled.py
Outdated
Show resolved
Hide resolved
I am trying to using MySQL as my default DB. I set all the environment variables list below: export DJANGO_DB="mysql"
export MYSQL_USER="root"
export MYSQL_PASSWORD="xxxx"
export MYSQL_NAME="labelstudio"
export MYSQL_HOST="127.0.0.1"
export MYSQL_PORT=3306
export POSTGRE_HOST= But while I am loading all the tasks for a project, an Exception like below raised:
And I found that, the generated SQL using PostgreSQL function SELECT COUNT(`__col1`), SUM(`total_annotations`)
, SUM(`total_predictions`)
FROM (
SELECT COUNT(DISTINCT CASE
WHEN NOT `task_completion`.`was_cancelled` THEN `task_completion`.`id`
ELSE NULL
END) AS `total_annotations`
, COUNT(DISTINCT CASE
WHEN `task_completion`.`was_cancelled` THEN `task_completion`.`id`
ELSE NULL
END) AS `cancelled_annotations`
, COUNT(DISTINCT `prediction`.`id`) AS `total_predictions`
, (
SELECT DISTINCT U0.`created_at`
FROM `task_completion` U0
INNER JOIN `task` U1 ON U0.`task_id` = U1.`id`
WHERE U0.`task_id` = `task`.`id`
AND U1.`is_labeled`
ORDER BY U0.`created_at` DESC
LIMIT 1
) AS `completed_at`, ARRAY_AGG(DISTINCT `task_completion`.`completed_by_id`) AS `annotators`, `task`.`id` AS `__col1`
FROM `task`
LEFT JOIN `task_completion` ON `task`.`id` = `task_completion`.`task_id`
LEFT JOIN `prediction` ON `task`.`id` = `prediction`.`task_id`
WHERE `task`.`project_id` = 1
GROUP BY `task`.`id`
ORDER BY NULL
) subquery I do not know if I have missed some other settings, and I have set POSTGRE_HOST to be empty as referencing to |
@loveychen #1501 --- check this PR |
Ok, I will check whether it solve the problem. |
MySQL is a popular DBMS and people have requested support (#787) for using it in label-studio.
Adding a config entry to
core/base.py
works but a migration fails:It turns out that an index gets created automatically for every
models.ForeignKey
ifdb_index
is not set toFalse
explicitly.A separate
docker-compose-mysql.yml
has been added to start label-studio with MySQL.