[ 
https://issues.apache.org/jira/browse/HIVE-29032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18007395#comment-18007395
 ] 

Denys Kuzmenko commented on HIVE-29032:
---------------------------------------

Merged to master

Thanks [~zabetak] for improving the qtest framework!

> Enhance qt:database option to expose connection properties in qfiles
> --------------------------------------------------------------------
>
>                 Key: HIVE-29032
>                 URL: https://issues.apache.org/jira/browse/HIVE-29032
>             Project: Hive
>          Issue Type: Improvement
>          Components: Testing Infrastructure
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>              Labels: pull-request-available
>
> The qt:database option is very useful for managing the life-cycle of 
> databases in qtests. 
> In many cases, though we need to set explicitly the connection properties, 
> i.e., url, username, password, etc., in the .q file.
> {code:sql}
> --!qt:database:postgres:q_test_country_table.sql
> CREATE EXTERNAL TABLE country
> (
>     id int,
>     name varchar(20)
> )
>     STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler'
>     TBLPROPERTIES (
>         "hive.sql.database.type" = "POSTGRES",
>         "hive.sql.jdbc.driver" = "org.postgresql.Driver",
>         "hive.sql.jdbc.url" = "jdbc:postgresql://localhost:5432/qtestDB",
>         "hive.sql.dbcp.username" = "qtestuser",
>         "hive.sql.dbcp.password" = "qtestpassword",
>         "hive.sql.table" = "country"
>         );
> {code}
> The developer needs to dig around in the code to find the values of these 
> properties, and whenever some value changes we are forced to update all the 
> .q files.
> I propose to enhance the qt:database option so that we can access the most 
> common connection properties (url, username, password) using variable 
> substitution.
> {code:sql}
> --!qt:database:postgres:q_test_country_table.sql
> CREATE EXTERNAL TABLE country
> (
>     id int,
>     name varchar(20)
> )
>     STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler'
>     TBLPROPERTIES (
>         "hive.sql.database.type" = "POSTGRES",
>         "hive.sql.jdbc.driver" = "org.postgresql.Driver",
>         "hive.sql.jdbc.url" = "${system:hive.test.db.postgres.jdbc.url}",
>         "hive.sql.dbcp.username" = 
> "${system:hive.test.db.postgres.jdbc.user}",
>         "hive.sql.dbcp.password" = 
> "${system:hive.test.db.postgres.jdbc.password}",
>         "hive.sql.table" = "country"
>         );
> SELECT * FROM country;
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to