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

adds support for id_column in tables for auto_publish #790

Merged
merged 26 commits into from
Aug 13, 2023

Conversation

Binabh
Copy link
Contributor

@Binabh Binabh commented Jul 30, 2023

Resolves #682

  • Get id_column string from config.yaml and use for id column
  • Support for list of strings
  • Add info/warnings if column is not there or is of wrong type
  • if column for the feature ID is found, remove it from properties (see inline comment)
  • cleanup logging messages
  • need more tests to catch other edge cases

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.

@Binabh thank you so much for working on this! Left a few suggestions inline

martin/src/pg/table_source.rs Outdated Show resolved Hide resolved
martin/src/pg/configurator.rs Outdated Show resolved Hide resolved
@sharkAndshark sharkAndshark marked this pull request as ready for review July 31, 2023 09:55
@sharkAndshark
Copy link
Collaborator

Oops.🥲I accidentally changed it from a draft state to ready for review. I was on a train

@Binabh Binabh marked this pull request as draft August 1, 2023 02:31
@Binabh
Copy link
Contributor Author

Binabh commented Aug 1, 2023

It may take few days for me to complete this. I have converted to draft.

@Binabh Binabh marked this pull request as ready for review August 1, 2023 17:20
@Binabh Binabh requested a review from nyurik August 1, 2023 17:20
@Binabh
Copy link
Contributor Author

Binabh commented Aug 1, 2023

@nyurik Thank you for your guidance. I have made the changes as per your suggestions. Also, I have tested manually with few variations in config files and this works good. Please let me know if anything. I will modify accordingly.

* don't clone when you can avoid it
* i think vec<T> is a bit easier here - just an internal optimization,
  shouldn't be exposed like this (not a clean external API, but ok
internally)
@nyurik
Copy link
Member

nyurik commented Aug 2, 2023

I made a few minor suggestions as a pr to your branch. Feel free to merge or comment on it. I'll make a note thorough read tomorrow

@Binabh
Copy link
Contributor Author

Binabh commented Aug 2, 2023

@nyurik I have looked and merged the changes.

nyurik added a commit that referenced this pull request Aug 3, 2023
* rename configuration `auto_publish.tables.id_format` and
`auto_publish.functions.id_format` fields from `id_format` to
`source_id_format` fields. The `id_format` will continue to be supported
(read) from the configuration, but it will be auto-converted to the new
name on save. It is an error to have both in the same config file.
  * The rename was discussed in #682

* internal refactorings: consolidate PG-related utilities, rename a few
vars, move PG errors to their own file.

This is partially made due to #790 (thanks @Binabh!) - and should be
merged before that to make that PR easier.
@Binabh
Copy link
Contributor Author

Binabh commented Aug 3, 2023

I see that the renaming is handled at serde serialization level. That is much cleaner approach. If I understand this correctly now the code that I wrote wrote supporting new name could be discarded right?

@nyurik
Copy link
Member

nyurik commented Aug 3, 2023

I will rebase it shortly -- that PR was the result of looking deeply into your code. I should be able to push it to your branch in a bit

@nyurik
Copy link
Member

nyurik commented Aug 3, 2023

I pushed a few minor changes and merged with the main branch. My next todo (i'll fix it) is to make it use the find_kv_ignore_case (i may need to do some more base code refactoring)

Detecting id column should only be done when adding all auto-detected tables to the sources.

I rewrote the logic, but did not test it fully. I added a simple test (we may want to add a few more), but currently tests break - not certain why yet - maybe the `from_schema` is not working correctly?

It's getting a bit late - try going from here.
@nyurik
Copy link
Member

nyurik commented Aug 3, 2023

I made a number of significant changes to the logic of this PR as part of the Binabh#2 (see notes).

TODO (if merged):

  • make tests pass
  • possibly add a few more tests?
  • check that the right properties are exposed, e.g. if it found an ID, that ID should no longer be shown in the properties list (need a test for this for sure)

@Binabh
Copy link
Contributor Author

Binabh commented Aug 3, 2023

I have merged.Can I give TODO list a try? It may take some days though.

@nyurik
Copy link
Member

nyurik commented Aug 3, 2023

Sorry, i just saw your comment - i made a few base improvements in #795 -- that gives some base for testing (I discovered a few minor issues in it).

TODO list is still relevant - i will merge the main into your PR once i merge 795, and then won't touch it until you message me :)

nyurik added a commit that referenced this pull request Aug 3, 2023
* on `--save-config`, only save configured `auto_publish` settings
* alias `from_schemas` as `from_schema`
* add integration testing for `auto_publish`
* if integration test DB preloading fails, try to clean up the test DB
* A few more info traces

This change should benefit testing of the #790 cc: @Binabh
Also fixed tests and other minor cleanup
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 todos inline

tests/expected/given_config.yaml Show resolved Hide resolved
docs/src/config-file.md Outdated Show resolved Hide resolved
martin/src/pg/configurator.rs Outdated Show resolved Hide resolved
martin/src/pg/configurator.rs Show resolved Hide resolved
tests/config.yaml Outdated Show resolved Hide resolved
@Binabh
Copy link
Contributor Author

Binabh commented Aug 4, 2023

Sorry, i just saw your comment - i made a few base improvements in #795 -- that gives some base for testing (I discovered a few minor issues in it).

TODO list is still relevant - i will merge the main into your PR once i merge 795, and then won't touch it until you message me :)

No worries, and thank you for this learning opportunity. I am learning a lot form your commits, commit messages and detailed comments. I will try these TODOs this weekend.
And surely, I will let you know if anything comes up.

@nyurik
Copy link
Member

nyurik commented Aug 12, 2023

@Binabh let me know if you need any help with this PR, seems like it needs just the tiny push to get ready for merge

@Binabh
Copy link
Contributor Author

Binabh commented Aug 12, 2023

@nyurik I have addressed almost all TODOs. Let me know if any improvements are needed.

@nyurik
Copy link
Member

nyurik commented Aug 12, 2023

Looks awesome! I will go over it tonight one last time before merging. I think it would be really good to add one or two more tests, but up to you

@Binabh
Copy link
Contributor Author

Binabh commented Aug 12, 2023

@nyurik I have added a test to check for feature id of type bigint. This is my first try writing test in Rust project. So, please let me know about it. I could revert commit if that test is unnecessary.

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.

thanks!!!

@nyurik nyurik enabled auto-merge (squash) August 13, 2023 01:40
@nyurik nyurik merged commit e3e6b35 into maplibre:main Aug 13, 2023
16 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.

Specifying an id column with auto_publish
3 participants