Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiveEngineSpec.get_view_names returns empty list even if corresponding function is available for hive dialect #8010

Closed
se7entyse7en opened this issue Aug 8, 2019 · 4 comments
Labels
inactive Inactive for >= 30 days

Comments

@se7entyse7en
Copy link

se7entyse7en commented Aug 8, 2019

Is your feature request related to a problem? Please describe.

The HiveEngineSpec.get_view_names returns empty list because HiveEngineSpec inherits from PrestoEngineSpec where get_view_names is set to return empty list. This is because https://github.com/dropbox/PyHive/blob/v0.6.1/pyhive/sqlalchemy_presto.py doesn't have a get_view_names function. But this function is available for https://github.com/dropbox/PyHive/blob/v0.6.1/pyhive/sqlalchemy_hive.py so it should make sense to call it. This prevents showing the list of the views in the SQL Editor tab.

Describe the solution you'd like

Add the following method to HiveEngineSpec:

    @classmethod
    def get_view_names(cls, inspector, schema):
        return BaseEngineSpec.get_view_names(inspector, schema)

Describe alternatives you've considered

None.

Additional context

I was able to actually test it in a project that is based on superset. This project uses a fork of PyHive in order to support SparkSQL, and has an engine spec for SparkSQL (open PR at the time of writing) which is simply defined as follows:

class SparkSQLEngineSpec(HiveEngineSpec):
    """Reuses HiveEngineSpec functionality."""

    engine = "sparksql"
@issue-label-bot
Copy link

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

@villebro
Copy link
Member

villebro commented Aug 8, 2019

It seems for Hive get_view_names() calls get_table_names(), which leads me to conclude that tables would show up twice: https://github.com/dropbox/PyHive/blob/v0.6.1/pyhive/sqlalchemy_hive.py#L267_L270 Or am I missing something?

@se7entyse7en
Copy link
Author

se7entyse7en commented Aug 8, 2019

Honestly, I don't know Hive much, but AFAIU with the SQLAlchemy Hive dialect you cannot distinguish views and tables, so calling get_view_names or get_table_names will return both views and tables. I don't even know whether it will return both internal and external ones in addition to views.

Maybe @erizocosmico or @ajnavarro you can help with this? Please also have a look at this referenced PR.

@stale
Copy link

stale bot commented Oct 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Oct 7, 2019
@stale stale bot closed this as completed Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

3 participants