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

Implement postgres auto-publish #546

Merged
merged 21 commits into from
Jan 3, 2023
Merged

Conversation

nyurik
Copy link
Member

@nyurik nyurik commented Dec 29, 2022

@nyurik nyurik requested a review from stepankuzmin December 29, 2022 07:06
@codecov-commenter
Copy link

codecov-commenter commented Dec 29, 2022

Codecov Report

Base: 58.47% // Head: 60.42% // Increases project coverage by +1.94% 🎉

Coverage data is based on head (75c7b5b) compared to base (64ad07c).
Patch coverage: 67.63% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #546      +/-   ##
==========================================
+ Coverage   58.47%   60.42%   +1.94%     
==========================================
  Files          23       23              
  Lines        1811     1933     +122     
==========================================
+ Hits         1059     1168     +109     
- Misses        752      765      +13     
Impacted Files Coverage Δ
src/bin/main.rs 2.27% <0.00%> (+0.09%) ⬆️
src/lib.rs 44.11% <ø> (ø)
src/pg/table_source.rs 45.00% <0.00%> (-0.38%) ⬇️
src/pg/utils.rs 51.92% <ø> (+4.30%) ⬆️
src/pg/config.rs 87.23% <64.28%> (-1.28%) ⬇️
src/pg/configurator.rs 45.33% <67.58%> (+37.58%) ⬆️
src/args/pg.rs 84.02% <87.50%> (+0.08%) ⬆️
src/utils/utilities.rs 52.00% <100.00%> (+4.00%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

* NEW: support for maplibre#512 - pg table/function auto-discovery
  * can filter schemas
  * can use patterns like `{schema}.{table}.{column}` and `{schema}.{function}`
* NEW: add `calc_bounds` bool flag to allow disabling of the bounds computation
* reworked integration tests to use yaml
src/pg/config.rs Outdated

#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct PgCfgPublish {
pub from_schema: Option<OneOrMany<String>>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it be from_schemas instead of from_schema as in #512?

Ok(Self {
pool,
default_srid: config.default_srid,
auto_functions: config.auto_functions.clone().unwrap_or(Schemas::Bool(auto)),
auto_tables: config.auto_tables.clone().unwrap_or(Schemas::Bool(auto)),
calc_bounds: config.calc_bounds.unwrap_or(true),
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can name it disable_bounds since this flag is intended to disable the default behavior (always expose bounds). We can also invert the default and use enable_bounds.

@@ -169,6 +221,41 @@ impl PgBuilder {
}
}

fn new_auto_publish(config: &PgConfig, is_function: bool) -> Option<PgBuilderPublish> {
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 okay to go with the notion that auto publish is true by default, as mentioned here #512 (comment)
But it still looks confusing and hard to reason about for me. We'd need to make this behavior clear in the docs.

@nyurik nyurik enabled auto-merge (squash) January 3, 2023 15:51
@nyurik nyurik merged commit 928a700 into maplibre:main Jan 3, 2023
@nyurik nyurik deleted the pg-auto-config branch January 3, 2023 16:09
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.

3 participants