Hey I'm having an issue with altering table partitions using JDBI. Here is an example of the query I'm trying to run:
ALTER TABLE table1 DROP PARTITION P_1
This runs fine in MySQL when dropping the partition "P_1" from the table "table1."
I've implemented it in my java code as the following:
@SqlUpdate("ALTER TABLE table1 DROP PARTITION :partition;")
public void deletePartition(@Bind("partition") String partition);
And call this function as such
deletePartition("P_1")
However, this results in the following error:
Causing: org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''P_1'' at line 1 [statement:"ALTER TABLE table1 DROP PARTITION :partition;", located:"ALTER TABLE table1 DROP PARTITION :partition;", rewritten:"/* HiveDropBoxDBI.deletePartition */ ALTER TABLE table1 DROP PARTITION ?;", arguments:{ positional:{}, named:{partition:'P_1'}, finder:[]}]
Is this functionality not supported? Or am I missing something with my syntax?
Thanks