1

I would like to be able to refer to tables with a certain naming schema to make my code uniform, but I am pulling tables from different environments with different naming schema. If I want all my tables to have names like example_table_1 and example_table_2, but the second one is something like TB_ex_2, is there a way to give that table an attribute so that I can also call select * from database.example_table_2, and it will know to refer to TB_ex_2?

I understand that I can alias tables, e.g. select * from TB_ex_2 example_table_2, but I am trying to avoid that. Renaming each table is also not an option, because those names need to be retained to identify which environment they are coming from.

leftjoin
  • 36,950
  • 8
  • 57
  • 116
bw1997
  • 37
  • 3

1 Answers1

0

Hive does not support synonyms. The workaround is to create a view:

CREATE VIEW table2 
  AS SELECT * from table1;

Also you can create many tables on top of the same location(data).

leftjoin
  • 36,950
  • 8
  • 57
  • 116