Query regarding Grafana’s database behavior across different backends

I have a query regarding Grafana’s database behavior across different backends.

In the case of MySQL, Grafana inherits MySQL’s default case-insensitive behavior, meaning it treats datasource names like “prometheus” and “Prometheus” as the same value. Because of this, if a user already has a datasource named “prometheus” and then attempts to create another datasource named “Prometheus”, Grafana returns an error stating that “a datasource with the same name already exists.”

However, when using SQLite3, we’ve observed different behavior. SQLite3 treats “prometheus” and “Prometheus” as separate entries, and both datasource names are stored distinctly in the SQLite3 database.

Is this the expected behavior wrt MySQL? Why doesn’t Grafana treat “prometheus” and “Prometheus” as two distinct entries in the MySQL database? Does this behavior require a fix or any configuration change?

How have you configured your mysql database for case sensitivity

MySQL might be sensitive and sqllite might not be

It is the other way around. MySQL is case-insensitive, whereas SQLite is case-sensitive. This is the default behavior as defined in the Grafana source code.

1 Like

Interesting. So does the source code branch out to a different code path when saving data to either sqlite and mySQL?

Can you please point to the lines of code?