Closed rafaelqntn-cfi closed 4 weeks ago
It works fine if we embed the name
variable in the query string instead of passing it as a parameter to the jdbcTemplate.queryForList
method.
protected boolean doExists() throws SQLException {
if (!schema.exists()) {
return false;
}
List<Map<String, String>> tables = jdbcTemplate.queryForList(
"show tables in " + database.quote(schema.getName()) + " like '"+ name +"';"
);
return tables.stream().anyMatch(table -> table.get("tableName").equals(name));
}
I was able to reproduce it with flyway version 10.15.2 as well used with Databricks, runtime version 15.1 (Apache Spark 3.5.0, Scala 2.12), no photon compute
It works fine if we embed the
name
variable in the query string instead of passing it as a parameter to thejdbcTemplate.queryForList
method.protected boolean doExists() throws SQLException { if (!schema.exists()) { return false; } List<Map<String, String>> tables = jdbcTemplate.queryForList( "show tables in " + database.quote(schema.getName()) + " like '"+ name +"';" ); return tables.stream().anyMatch(table -> table.get("tableName").equals(name)); }
Would you be willing to raise a PR with the fix?
Yes, I can do it. I will check the developers' guide to see if I need to include something and submit the PR.
Hi! First, I would like to thank you all for releasing the Databricks support.
I was testing it today and got the following error message:
fwt
is the schema I am using for testing purposes.It looks like the issue is caused by
flyway_schema_history
(table name) not replacing the parameter placeholder?
. I think the problem can be solved by changing the following line of code:https://github.com/flyway/flyway-community-db-support/blob/02ce47e7a0be94c7943c8a80e05d3ec9b874cea1/flyway-database-databricks/src/main/java/org/flywaydb/community/database/databricks/DatabricksTable.java#L36
This is called here (parent project):
https://github.com/flyway/flyway/blob/0e1f98e2069a8e363d51c885d66c5faef2cabe8e/flyway-core/src/main/java/org/flywaydb/core/internal/database/base/Table.java#L45
Thanks!
flyway --version
output:Database: SparkSQL 3.1 JDBC jar: databricks-jdbc-2.6.38.jar