Export: support export in postgresql (#58553)

This commit is contained in:
Ryan McKinley
2022-11-10 14:16:31 -05:00
committed by GitHub
parent 47055561ec
commit f92d978386
13 changed files with 109 additions and 45 deletions
+29
View File
@@ -0,0 +1,29 @@
package export
import (
"strings"
"github.com/grafana/grafana/pkg/infra/db"
)
func isTableNotExistsError(err error) bool {
txt := err.Error()
return strings.HasPrefix(txt, "no such table") || // SQLite
strings.HasSuffix(txt, " does not exist") || // PostgreSQL
strings.HasSuffix(txt, " doesn't exist") // MySQL
}
func removeQuotesFromQuery(query string, remove bool) string {
if remove {
return strings.ReplaceAll(query, `"`, "")
}
return query
}
func isMySQLEngine(sql db.DB) bool {
return sql.GetDBType() == "mysql"
}
func isPostgreSQL(sql db.DB) bool {
return sql.GetDBType() == "postgres"
}