You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2025/06/20 15:40:00 UTC
[jira] [Created] (HIVE-29032) Enhance qt:database option to expose connection properties in qfiles
Stamatis Zampetakis created HIVE-29032:
------------------------------------------
Summary: 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
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)