tempto
tempto copied to clipboard
need to support multiple databases in a single convention based test
To test connectors in a way that is repeatable without a lot of setup, we need to support the ability to create a table on a jdbc database, and then query it through presto.
When I run the following test, "describe mysql.test.workers_jdbc" is executed on mysql instead of on presto.
-- database: mysql; tables: workers_jdbc; groups: mysql_connector2;
--!
select * from workers_jdbc limit 1;
--!
-- database: presto; groups: mysql_connector2; queryType: SELECT;
--!
describe mysql.test.workers_jdbc
--!
-- delimiter: |; trimValues: true; ignoreOrder: true;
id_employee | bigint | true | false | |
first_name | varchar | true | false | |
last_name | varchar | true | false | |
date_of_employment | date | true | false | |
department | bigint | true | false | |
id_department | bigint | true | false | |
name | varchar | true | false | |
salary | bigint | true | false | |
Here's the error
2015-07-30 00:42:12 DEBUG [Mysql.describe_table_2_1438196230736] c.t.t.i.i.TestInitializationListener - Cleaning for fulfiller class com.teradata.tempto.internal.fulfillment.table.MutableTablesFulfiller
2015-07-30 00:42:12 ERROR [] c.t.t.i.l.ProgressLoggingListener - Exception: com.teradata.tempto.query.QueryExecutionException: 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 '.workers_jdbc' at line 1
at com.teradata.tempto.query.JdbcQueryExecutor.execute(JdbcQueryExecutor.java:92)
at com.teradata.tempto.query.JdbcQueryExecutor.executeQuery(JdbcQueryExecutor.java:62)
at com.teradata.tempto.internal.convention.sql.SqlQueryConventionBasedTest.runTestQuery(SqlQueryConventionBasedTest.java:112)
at com.teradata.tempto.internal.convention.sql.SqlQueryConventionBasedTest.test(SqlQueryConventionBasedTest.java:90)
at com.teradata.tempto.internal.convention.ConventionBasedTestProxyGenerator$ConventionBasedTestProxy.test(ConventionBasedTestProxyGenerator.java:101)
at com.teradata.tempto.Mysql.describe_table_2(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)