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

Support late binding view #118

Conversation

ragi256
Copy link
Collaborator

@ragi256 ragi256 commented Apr 2, 2019

This PR is for support late-binding view. The PR has 3 modification about late binding view.

  1. add pg_get_late_binding_view_cols to fetch_table_names method in redshift_adapter
    • instance variable for LATE BINDING
    • change fetch_column source table to svv_columns
  2. fetch meta data of view, a query of view and a planning of the query
  3. show the meta data
    • ViewMetaDatum model
    • split to partial views, _raw_dataset and _view_meta_data in table_memo#show

If the table of a memo page is view regardless whether late binding or not, show the meta data like the following.

sample image

Mysql2 adapter uses information_schema.tables to count rows.
The table update when analyze table. If select table rows before analyze, table_rows return 0.
@ragi256 ragi256 merged commit bccd999 into cookpad:master Apr 2, 2019

def fetch_view_query_plan(query)
return nil if query.blank?
query = query.sub(/create view .*?as/, '').sub('with no schema binding', '')
super
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nits] It is not natural that super passes replaced query, you should write as super query explicitly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants