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

Add capacity to customize WITH clause options in CREATE MATERIALIZED VIEW via create_continuous_aggregate #58

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

g-langlois
Copy link
Contributor

@g-langlois g-langlois commented Mar 28, 2024

This PR is to add the capacity to customize the WITH clause options in CREATE MATERIALIZED VIEW via create_continuous_aggregate. The options are materialized_only, finalized and create_group_indexes.
Note: In the proposed implementation, if those options are not specified, the defaults from TimescaleDB extension will be used (the defaults have changed between versions).
This PR also add handling of materialized_only and finalized in the schema dumper. Unfortunately, create_group_indexes is not handled since there is no safe way to obtain this information (if there is one, please let me know!).

@g-langlois g-langlois changed the title Add capacity to override WITH clause defaults in create_continuous_aggregate Add capacity to customize CREATE MATERIALIZED VIEW WITH clauses via create_continuous_aggregate Mar 28, 2024
@g-langlois g-langlois changed the title Add capacity to customize CREATE MATERIALIZED VIEW WITH clauses via create_continuous_aggregate Add capacity to customize WITH clause options in CREATE MATERIALIZED VIEW via create_continuous_aggregate Mar 28, 2024
@jonatas
Copy link
Collaborator

jonatas commented Mar 28, 2024

Thanks for adding the details! I"m going to review and test it soon 🤞

Copy link
Collaborator

@jonatas jonatas left a comment

Choose a reason for hiding this comment

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

Very good! thanks for fixing and updating this!

I hope in the future we also make all keys more dynamic!

I'll be merging it soon. @g-langlois I'll be releasing a new version but first I'd like to double check if any of the other bugs can also be fixed.

else
""
end
Timescaledb::ContinuousAggregates.all.find_each do |aggregate|
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the find_each replacement 🧠

In the future, we may think about also adding a order to keep the caggs name alphabetically or just follow the natural order 🤓

Copy link
Contributor Author

@g-langlois g-langlois Mar 28, 2024

Choose a reason for hiding this comment

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

That would be a good idea! Looks like rails order the tables alphabetically in schema.rb, so it would make sense to also order this alphabetically.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm just curious if we should build some advanced query for considering the hierarchical stuff because they'll need to be in the right order 😃

@jonatas jonatas merged commit 1e22b24 into timescale:master Mar 28, 2024
2 checks passed
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.

2 participants