grafana / grafana/database-migrator

Some parts of the export contain to few backslashes

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

Description

Hi

we use grafana as a part of percona's monitoring and management tool. While migrating that grafana (9.2.13) from sqlite to mysql backend, we faced the following issue:

Some dashboards have this in their data:

```
"regex":"/(([0-9\\.]+)\\.([0-9\\.]+)\\.([0-9\\.]+)-?([0-9?]+))/"
```

This is also exactly what goes into the dumped sql file.

However, after importing it into mysql, the data looks like this:

```
"regex":"/(([0-9\.]+)\.([0-9\.]+)\.([0-9\.]+)-?([0-9?]+))/"
```

Which ends up in a parse error and non-functional dashboard.

We manually edited the dump file so that it said

```
"regex":"/(([0-9\\\\.]+)\\\\.([0-9\\\\.]+)\\\\.([0-9\\\\.]+)-?([0-9?]+))/"
```

The dump could then be imported just fine.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the migration using a Grafana 9.2.13 SQLite database containing the shown regex and compare the generated SQL dump with the imported MySQL data. Trace the export and SQL escaping path, then verify that backslashes are preserved and the resulting dashboard data parses correctly after import.

Written by the indexing model from the issue text.

Assessment

Tech stack
grafana, mysql, shell, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.