question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

run_tags table not created during initial schema creation in mysql

See original GitHub issue

Dagster version

0.15.6

What’s the issue?

I am using the following Dagster config for schedules in a local, empty installation:

schedule_storage:
  module: dagster_mysql.schedule_storage
  class: MySQLScheduleStorage
  # ... etc

On first run, the following tables are created:

'alembic_version'
'asset_keys'
'bulk_actions'
'daemon_heartbeats'
'event_logs'
'instance_info'
'instigators'
'job_ticks'
'jobs'
'kvs'
'runs'
'secondary_indexes'
'snapshots'

However, no runs_tags table exists. As a result, I see an error in the Dagit UI on the Schedules page:

Operation name: InstanceSchedulesQuery

Message: (mysql.connector.errors.ProgrammingError) 1146 (42S02): Table 'dagster_db.run_tags' doesn't exist
[SQL: SELECT subquery.id, subquery.run_body, subquery.status, subquery.create_timestamp, subquery.update_timestamp, subquery.start_time, subquery.end_time 
FROM (SELECT runs.id AS id, runs.run_body AS run_body, runs.status AS status, runs.create_timestamp AS create_timestamp, runs.update_timestamp AS update_timestamp, runs.start_time AS start_time, runs.end_time AS end_time, rank() OVER (PARTITION BY run_tags.value ORDER BY runs.id DESC) AS `rank` 
FROM runs INNER JOIN run_tags ON runs.run_id = run_tags.run_id 
WHERE run_tags.`key` = %(key_1)s AND run_tags.value IN (%(value_1_1)s)) AS subquery 
WHERE subquery.`rank` <= %(rank_1)s ORDER BY subquery.`rank` ASC]
[parameters: {'key_1': 'dagster/schedule_name', 'rank_1': 1, 'value_1_1': 'my_schedule'}]
(Background on this error at: https://sqlalche.me/e/14/f405)

Path: ["repositoriesOrError","nodes",0,"schedules",0,"scheduleState","runs"]

Locations: [{“line”:141,“column”:3}]

What did you expect to happen?

The Schedules feature should work in a fresh installation without any issues.

How to reproduce?

Repro steps are the same as in this bug https://github.com/dagster-io/dagster/issues/4324

Simply start with a fresh, empty mysql database with Dagster 0.15.6, and this will be the result.

I may attach a gist with a docker-compose for fast repro.

Deployment type

Docker Compose

Deployment details

This is being done locally using a custom Docker Compose project

Additional information

I am guessing https://github.com/dagster-io/dagster/pull/7815 this PR introduced the bug. @prha and @gibsondan perhaps could have a second look.

Message from the maintainers

Impacted by this issue? Give it a 👍! We factor engagement into prioritization.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
prhacommented, Jul 28, 2022

We think this might be a race-condition bug in initializing the database. If this is a clean setup, you might want to wipe everything and try initializing again?

1reaction
prhacommented, Jul 28, 2022

Hi Mike… the run tags table is associated with run_storage. Is your run storage also configured to use the same MySQL db?

It’d look something like this:

# in dagster.yaml
run_storage:
  module: dagster_mysql.run_storage
  class: MySQLRunStorage
  config:
     mysql_url: "mysql+mysqlconnector://..."
Read more comments on GitHub >

github_iconTop Results From Across the Web

MySQL 8.0 Reference Manual :: 13.1.12 CREATE DATABASE ...
Because there are no tables in a database when it is initially created, the CREATE DATABASE statement creates only a directory under the...
Read more >
How to create a database schema in MySQL | TheServerSide
Open the MySQL Workbench; Click the Create Schema option; Provide a schema name; Click apply to create the MySQL scheme. The MySQL workbench ......
Read more >
MySQL: Can't create table (errno: 150) - Stack Overflow
If these are not satisfied, MySQL returns Error 1005 and refers to Error 150 in the error message, which means that a foreign...
Read more >
MySQL CREATE TABLE Statement By Examples
First, you specify the name of the table that you want to create after the CREATE TABLE keywords. The table name must be...
Read more >
run_tags table not created during initial schema creation in ...
schedule_storage: module: dagster_mysql.schedule_storage class: MySQLScheduleStorage # ... etc. On first run, the following tables are created:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found