-
Notifications
You must be signed in to change notification settings - Fork 77
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
--persist-replace argument #440
--persist-replace argument #440
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some comments.
Question - can we detect if the user tries to use --persist
for the 2nd time and suggest him to use --persist-replace
instead?
…persist-replace-argument-if-there-is-existing-table
I checked the preview doc, somehow there is the empty cell in the original --persist section, do you think our PR affect this? |
Now if we use --persist twice it will suggest to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some minor comments
I assume this isn't an expected behavior? If not fix it, if yes document it |
Still figuring out why the empty cell was generated... |
I don't think it's related to your changes in this PR, but it might be a good idea to remove it since it's a small and simple change that will make the documentation cleaner without affecting anything else. |
@tonykploomber please fix and resolve comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're missing the most important part of the test. We need to make sure --persist-replace
overrides the previous data. To do it, we need to use 2 different datasets.
saved_df_name = get_table_rows_as_dataframe(ip, table_name=test_table)
ip.run_cell(f"%sql --persist sqlite:// {saved_df_name}")
saved_df_name = get_table_rows_as_dataframe(ip, table_name=test_table)
ip.run_cell(f"%sql --persist-replace sqlite:// {saved_df_name}")
assert out.result == expected_result
even if --persist-replace
doesn't work, it will return True.
Please note, this is valid for the contrapositive tests as well (i.e. test_persist_replace_no_override
). If you are using the same data, it will be difficult to determine whether it was not overridden.
@yafimvo We can also just get the different dataframe by putting different Please review again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we've discussed this about this is previous comment. That's why previous
query_and_save_as_dataframe
function has limit parameter to generate a different dataset to test the override effect.
Since we didn't check for different lengths, I suggested setting the limit parameter as optional and making this function return X rows of a given table as a dataframe.
We can also just get the different dataframe by putting different
table_name
toget_table_rows_as_dataframe
.
I see you implemented something like this.
LGTM. just minor fixes.
…persist-replace-argument-if-there-is-existing-table
This is blocked by CI test failing issue |
…persist-replace-argument-if-there-is-existing-table
@yafimvo This is ready for review again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks good overall, added some minor comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just show a proper warning
…persist-replace-argument-if-there-is-existing-table
Please review again |
CHANGELOG.md
Outdated
* [Feature] Better error messages when function used in plotting API unsupported by DB driver (#159) | ||
* [Fix] Fix the default value of %config SqlMagic.displaylimit to 10 (#462) | ||
* [Feature] Detailed error messages when syntax error in SQL query, postgres connection password missing or inaccessible, invalid DuckDB connection string (#229) | ||
* [Feature] Adds `--persist-replace` argument (#440) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some rebase went bad? I see some entries in the changelog are deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…persist-replace-argument-if-there-is-existing-table
Describe your changes
Add
--persist-replace
argumentIssue number
Closes #154
Checklist before requesting a review
pkgmt format
📚 Documentation preview 📚: https://jupysql--440.org.readthedocs.build/en/440/