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 ability to copy to existing mbtiles files #778

Merged
merged 15 commits into from
Jul 27, 2023

Conversation

upsicleclown
Copy link
Collaborator

@upsicleclown upsicleclown commented Jul 21, 2023

  • Allow the dst in mbtiles copy <src> <dst> command to already contain data, merging tilesets
  • Add mbtiles copy --on-duplicate (override|ignore|abort)

Copy link
Member

@nyurik nyurik left a comment

Choose a reason for hiding this comment

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

a few minor feedbacks, will review more later

martin-mbtiles/src/errors.rs Outdated Show resolved Hide resolved
martin-mbtiles/src/errors.rs Outdated Show resolved Hide resolved
martin-mbtiles/src/tile_copier.rs Show resolved Hide resolved
martin-mbtiles/src/tile_copier.rs Outdated Show resolved Hide resolved
martin-mbtiles/src/tile_copier.rs Outdated Show resolved Hide resolved
@upsicleclown upsicleclown force-pushed the mbtiles-copy-to-existing-file branch from 8c7670d to b3a2cce Compare July 21, 2023 14:54
@upsicleclown upsicleclown force-pushed the mbtiles-copy-to-existing-file branch from b3a2cce to 6ed3195 Compare July 21, 2023 15:00
};

let mut unique_idx_cols = HashSet::new();
let query_string = format!(
Copy link
Member

Choose a reason for hiding this comment

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

apparently this can actually be done in a "safer" way (the whole point of sqlx as oppose to calling sqlite directly) - https://docs.rs/sqlx-conditional-queries/0.1.3/sqlx_conditional_queries/macro.conditional_query_as.html

Should we try to use that approach? Could be a separate PR though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This conditional_query_as! macro seems to use the query_as! macro. This query is a PRAGMA query which doesn't work with sqlx macros.

@upsicleclown upsicleclown marked this pull request as ready for review July 26, 2023 18:05
@upsicleclown upsicleclown changed the title WIP - add ability to copy to existing mbtiles files Add ability to copy to existing mbtiles files Jul 26, 2023
Copy link
Member

@nyurik nyurik left a comment

Choose a reason for hiding this comment

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

one minor fix, and should be good to go :)

martin-mbtiles/src/mbtiles.rs Outdated Show resolved Hide resolved
Copy link
Member

@nyurik nyurik left a comment

Choose a reason for hiding this comment

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

awesome, thank you!!!

@upsicleclown upsicleclown enabled auto-merge (squash) July 27, 2023 18:28
@nyurik nyurik disabled auto-merge July 27, 2023 18:30
@nyurik nyurik enabled auto-merge (squash) July 27, 2023 18:30
@nyurik nyurik merged commit 42c2df4 into maplibre:main Jul 27, 2023
16 checks passed
lefuturiste pushed a commit to lefuturiste/martin that referenced this pull request Aug 26, 2024
* Allow the `dst` in `mbtiles copy <src> <dst>` command to already
contain data, merging tilesets
* Add `mbtiles copy --on-duplicate (override|ignore|abort)`

---------

Co-authored-by: rstanciu <[email protected]>
Co-authored-by: Yuri Astrakhan <[email protected]>
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