grafana / grafana/database-migrator

Timezone identifiers exported on come columns causing error on mysql/mariadb import.

Open
#11 6 comments 4 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
126
Forks
15
PR merge metrics
No merged PRs in 30d

Description

I'm using this script to migrate a Grafana 6.6.1 installation from SQLite to MariaDB. When I attempt to import the dump with the mysql client I get the following error:

```
ERROR 1292 (22007) at line 368: Incorrect datetime value: '2022-07-12 08:16:10.96344947+00:00' for column `grafana`.`alert`.`new_state_date` at row 1
```

It looks like this column (and potentially others) has been set up to print timezone info when selected, making the string literals incompatible with the mysql/mariadb `DATETIME` type.

A simple find/replace of `+00:00` with an empty string fixed this for my case, but it might be worth integrating this into the script or at least calling it out in the README.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the migration script and README, then reproduce the SQLite-to-MySQL/MariaDB export around alert.new_state_date. Done means the generated SQL imports without timezone-suffixed DATETIME values; document the behavior in the README if that is the chosen resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, mysql, shell, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.