Access tables from several connections in a Hive notebook

Solved!
UserBird
Dataiker
Access tables from several connections in a Hive notebook
I have several HDFS connections. When I write a Hive recipe, I can access the tables from all connections.
But I like to develop and test my SQL code in a Hive notebook first. In this notebook, I can see only the tables from one connection.
1 Solution
jrouquie
Dataiker Alumni

Good news, all tables can be accessed in a Hive notebook. One simply needs to keep in mind that different connections correspond to different namespaces.



To access table foo from another connection, prefix its name by the database name (for instance โ€œdb_barโ€):




SELECT count(*) FROM db_bar.foo


Note that you'll need to remove the prefix when converting to a recipe. The database name is shown above the sql code area: ยซconnected to db_bar (Hive)ยป and is distinct from the connection name.

You can also find all database names by executing the SQL query




show databases


 



 



Note: you might also check the metastore sync: open the dataset, click settings โ†’ advanced โ†’ metastore: Synchronize.

View solution in original post

0 Kudos
1 Reply
jrouquie
Dataiker Alumni

Good news, all tables can be accessed in a Hive notebook. One simply needs to keep in mind that different connections correspond to different namespaces.



To access table foo from another connection, prefix its name by the database name (for instance โ€œdb_barโ€):




SELECT count(*) FROM db_bar.foo


Note that you'll need to remove the prefix when converting to a recipe. The database name is shown above the sql code area: ยซconnected to db_bar (Hive)ยป and is distinct from the connection name.

You can also find all database names by executing the SQL query




show databases


 



 



Note: you might also check the metastore sync: open the dataset, click settings โ†’ advanced โ†’ metastore: Synchronize.

0 Kudos

Labels

?
Labels (3)
A banner prompting to get Dataiku