-
Notifications
You must be signed in to change notification settings - Fork 16
Dataset derive from pandas data frame? #281
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
Comments
That, and it would be nice to load/export a dict/json/etc as a dataset. Some interesting google results: https://github.com/petbox-dev/tafra https://github.com/sfu-db/connector-x |
Got it pretty close to working (at least for the sqlite driver). More debugging and troubleshooting to go!
More cleanup and experimentation. There is an issue with saving where sometimes the dict gets an extra key "0" and the update query fails. Also, even at times that the query goes through, the DataSet does not seem to update immediately to show the difference
A little closer now. New records insert and mark as virtual. There was an issue with using .applymap on DataSet.rows, as .applymap returns a Dataset object directly, which was overwriting the ResultSet object. This fixes that issue. Still more to go, but another step closer
I'm done for the night. Was going to look at delete behavior next. Have at it if you're up - I wont be back for 12 hours or so. It looks pretty simple - the recursion constants returned don't play well with Pandas directly (ambiguous compares), so we need a slightly different solution (maybe even adding them as a status in the ResultSet?) |
Is it because black turned our constant int into a tuple? I don’t have time to check, but fix this first:
|
Or maybe that isn’t a tuple (remember, you’re working with a big newbie here) either way, the way black handles trailing comments leaves something to be desired for sure. |
I’ll take a look at it tomorrow. I return None if the parent doesn’t have a dependent in delete_record_recursive… which probably isn’t right. |
Because then it’s comparing “if Result (None) == int” |
Just writing a few quick thoughts down
I might try using DataFrame.attrs to store the extra metadata that is normally associated with a ResultSet. This should make it much easier to use the DataFrame objects |
I was reading up on attrs. When I get to work I’ll check if this bug (pandas-dev/pandas#41572) is still unfixed. Apparently they arnt always persistent in all operations / don’t reattach on copy? Also see this discussion: pandas-dev/pandas#52166 maybe it’s worth storing them separate eg Dataset.rows_df (current rows) |
Yeah, though I think the bug revolves more around DataFrame attrs overwriting Series attrs, which shouldn't affect us. We will see I guess. I already have huge progress on eliminating ResultSet and using DataFrames directly. I have sorting 90% working now also (I need to rewrite the part that sorts based on the fk relationship). So far there have been no issues in my testing. I'm hoping to push the changes soon, just getting sporadic chances to work on it so far today |
Awesome. I figured you would be the better judge on if that was a big deal or not. |
Worked towards getting rid of ResultSet entirely and having SQLDriver.execute() returning DataFrames directly with the appropriate attrs set
Sorting code moved into DataSet. Still some work to do, but very close to being functional again
Sorting code working. Still need to work out how to sort FK relationships by their description column
Pretty big step backwards with this one. Working on cleaning up the sorting code had some unexpected consequences. I'm out of time for a while, so checking this in for now
@PySimpleSQL I think my most recent push fixes most stuff. 1 issue:
what additional part of _SortCallbackWrapper do you want to integrate into def sort? (if any)
|
I think this gets us almost all the way there. in insert_row, setting the idx is not implemented yet Also, ruff is complaining about: F405: 'ResultSet' may be undefined ... but I didn't know what to replace that with.
Per above commit, things I didn’t know how to handle:
|
thanks for letting me mop the new floors you put in 😄 |
Thanks! Sorry for leaving things in such an unfinished state - i was supposed to have a nice block of time that fell to pieces on me unfortunately (i worked at 20 hour day yesterday). I just pulled your changes in and going to give things a whirl to see where everything stands. I know this has been a giant pain, but having pandas support will be a huge feature. It can be a pain to use for simple things, but it has so much power for manipulating and accessing data! |
Cleaned up a lot of the ResultSet references that are no longer valid now that we are working with DataFrames. Changed the set_by_pk call to update_elements, otherwise the navigation buttons don't update after sorting
Searching for records works as expected again
Sorting for foreign keys works again. A temporary column is added that maps the fk to the description column of the parent table, the dataset is sorted on this temporary column, then the temporary column is dropped in place.
Duplicating records working once again
Made some fairly decent progress today. There are still a few oddball issues floating yet (crash when navigating away from changed record and prompting "No" for example). Just need to find the rest of these small issues and fix them, then the last remaining task will be to update all of the drivers to work properly, using the Sqlite driver as a reference as to what has changed |
It's all good, not your fault. My schedule has been completely bonkers
this week. I've literally had just a few minutes at a time to try to test
and pound something out, just to have something else come up. It's been
just crazy
…On Thu, Apr 20, 2023, 4:29 PM ssweber ***@***.***> wrote:
Maybe when you have all the drivers changed over, I can help spinning each
one up and reporting if there's anything still borked.
—
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQX2RETG5FI7HMJIWCUPTITXCGMC7ANCNFSM6AAAAAAW4YNJ64>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
override insert_record - Jackcess does not like columns set to None
Duplicate now mostly working (selects wrong item after duplicate still). Had to remove quote_table stuff from the driver, as the variable is used in other places that do not expect it to be quoted - it's not needed anyway, as this is specific driver code and not generalized for all SQLDrivers
BTW - I just tested Mysql example on development, and duplicate didn't jump to the right record afterwords there either. So that's not a pandas-specific issue. |
Duplicate now working. DROP TABLE IF EXISTS does not seem to work reliably through Jackcess, so added a workaround. The lastrowid was not being returned due to the nature of the executing a list of queries, so grabbed the inserted id after all of the queries were finished.
Yeah, I saw that too. I have a fix for it now. I should get into one of
the upcoming pushes. It's working well now in MSAccess
…On Fri, Apr 21, 2023, 11:10 AM ssweber ***@***.***> wrote:
BTW - I just tested Mysql example on development, and duplicate didn't
jump to the right record afterwords there either. So that's not a
pandas-specific issue.
—
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQX2REQO6PYBRVBLGAAMUELXCKPM3ANCNFSM6AAAAAAW4YNJ64>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
commit 35f8bf3 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 11:36:03 2023 -0400 Fixes lastrowid not being returned correctly in duplicate Old code was trying to get the lastrowid after the entire list of queries ran, which would return None due to the insert being buried in the list of queries. We now grab it after the insert runs by chacking if it has been set yet, and if the result has a lastrowid commit 9628f65 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 11:29:31 2023 -0400 refs #281 MSAccess fixes Small fixes / ruff fixes commit 3f24c38 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 11:23:28 2023 -0400 refs #281 MSAccess fixes Duplicate now working. DROP TABLE IF EXISTS does not seem to work reliably through Jackcess, so added a workaround. The lastrowid was not being returned due to the nature of the executing a list of queries, so grabbed the inserted id after all of the queries were finished. commit f904950 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 10:26:48 2023 -0400 refs #281 MSAccess fixes Duplicate now mostly working (selects wrong item after duplicate still). Had to remove quote_table stuff from the driver, as the variable is used in other places that do not expect it to be quoted - it's not needed anyway, as this is specific driver code and not generalized for all SQLDrivers commit c53caa7 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 09:39:31 2023 -0400 refs #281 MSAccess fixes override insert_record - Jackcess does not like columns set to None commit 2179061 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 09:26:28 2023 -0400 refs #281 Pandas integration resolved a small merge conflict commit 3ff3385 Author: PySimpleSQL <[email protected]> Date: Thu Apr 20 15:58:42 2023 -0400 refs #281, Got a little bit of MSAccess working Duplicate still broken. Out of time to look at it for now commit fc134c3 Merge: 87e9fac 456c5a7 Author: PySimpleSQL <[email protected]> Date: Thu Apr 20 15:58:29 2023 -0400 Merge remote-tracking branch 'origin/pandas' into pandas # Conflicts: # pysimplesql/pysimplesql.py commit 87e9fac Author: PySimpleSQL <[email protected]> Date: Thu Apr 20 15:55:12 2023 -0400 refs #281, Got a little bit of MSAccess working Duplicate still broken. Out of time to look at it for now commit 456c5a7 Author: ssweber <[email protected]> Date: Thu Apr 20 15:48:17 2023 -0400 black commit 3c78b07 Author: ssweber <[email protected]> Date: Thu Apr 20 15:47:51 2023 -0400 Sqlserver conversions still need to do sqlserver pk_column... didn't have time to start up docker to test how that get returned commit a465cd4 Author: ssweber <[email protected]> Date: Thu Apr 20 15:43:42 2023 -0400 More Result.set conversions Access has issue with save and duplicate commit 204842b Author: PySimpleSQL <[email protected]> Date: Thu Apr 20 11:46:07 2023 -0400 refs #281, Flatfile fixes Small fixes to Flatfile driver to work with pandas commit 2030c32 Author: ssweber <[email protected]> Date: Wed Apr 19 16:15:07 2023 -0400 Safeguard error if query somehow fails commit e5e1918 Author: ssweber <[email protected]> Date: Wed Apr 19 15:39:32 2023 -0400 Reverting line change I think both work correctly, so I'll just keep the one you wrote :) commit 10427c8 Author: ssweber <[email protected]> Date: Wed Apr 19 15:16:26 2023 -0400 Working mysql/postgres sql drivers Also fixed duplicate button always disabled Found other places where we needed to look at attrs instead of result.exception commit 9d86d1b Author: ssweber <[email protected]> Date: Wed Apr 19 13:54:40 2023 -0400 Update pysimplesql.py commit b7db10f Author: ssweber <[email protected]> Date: Wed Apr 19 13:53:33 2023 -0400 Fix for quick_editor, save_record Now with updated sqlite driver, this needed to update attrs commit f26c5b4 Author: ssweber <[email protected]> Date: Tue Apr 18 16:47:03 2023 -0400 Fixed checking for TableHeading I think this fixes the quick-editor commit 6a256a3 Author: ssweber <[email protected]> Date: Tue Apr 18 16:23:23 2023 -0400 Update pysimplesql.py commit 454a766 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 15:25:14 2023 -0400 refs #281, set_by_pk improvements There were certain situations where set_by_pk would fail if the primary key was not found (like after deleting a virtual record.). This ensures that an index will be selected even if the pk value is not found commit 7f159d8 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 15:18:35 2023 -0400 refs #281, set_by_pk improvements There were certain situations where set_by_pk would fail if the primary key was not found (like after deleting a virtual record.). This ensures that an index will be selected even if the pk value is not found commit b84643d Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 14:34:25 2023 -0400 refs #281, Purge virtual working DataSet.purge_virtual is now working. Also added some pandas display options for easier debugging commit 3ebcd20 Merge: 149bdc7 749c717 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 12:49:42 2023 -0400 Merge pull request #288 Moved things from _SortCallbackWrapper to sort commit 149bdc7 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 12:47:36 2023 -0400 refs #281, Duplicate record working oops, forgot something commit 749c717 Author: ssweber <[email protected]> Date: Tue Apr 18 12:31:24 2023 -0400 Update pysimplesql.py commit db4030d Author: ssweber <[email protected]> Date: Tue Apr 18 12:28:07 2023 -0400 Update pysimplesql.py commit aa7c8ac Author: ssweber <[email protected]> Date: Tue Apr 18 12:27:04 2023 -0400 Move from _SortCallbackWrapper to sort commit 32266f1 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 12:20:38 2023 -0400 refs #281, Duplicate record working Duplicating records working once again commit 28118ed Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 12:04:34 2023 -0400 refs #281, Sorting by foreign keys Sorting for foreign keys works again. A temporary column is added that maps the fk to the description column of the parent table, the dataset is sorted on this temporary column, then the temporary column is dropped in place. commit caa0754 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 11:03:10 2023 -0400 refs #281, Record search working again Searching for records works as expected again commit ccabe70 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 10:01:56 2023 -0400 refs #281, Pandas more cleanup Cleaned up a lot of the ResultSet references that are no longer valid now that we are working with DataFrames. Changed the set_by_pk call to update_elements, otherwise the navigation buttons don't update after sorting commit 25e5495 Author: ssweber <[email protected]> Date: Tue Apr 18 00:19:37 2023 -0400 fixes navigation buttons being wrong commit b7f7051 Author: ssweber <[email protected]> Date: Tue Apr 18 00:09:37 2023 -0400 Lots of fixes I think this gets us almost all the way there. in insert_row, setting the idx is not implemented yet Also, ruff is complaining about: F405: 'ResultSet' may be undefined ... but I didn't know what to replace that with. commit a9928e5 Author: ssweber <[email protected]> Date: Mon Apr 17 20:36:40 2023 -0400 small fix you're right, somethings still borked with sorting. sorry, this at least gets it in a workable state. commit 50e7430 Author: ssweber <[email protected]> Date: Mon Apr 17 17:08:48 2023 -0400 fixes commit 76b4835 Author: PySimpleSQL <[email protected]> Date: Mon Apr 17 15:48:42 2023 -0400 refs #281, Pandas partially working Pretty big step backwards with this one. Working on cleaning up the sorting code had some unexpected consequences. I'm out of time for a while, so checking this in for now commit 0a77f5e Author: PySimpleSQL <[email protected]> Date: Mon Apr 17 12:43:31 2023 -0400 refs #281, Pandas partially working Sorting code working. Still need to work out how to sort FK relationships by their description column commit e3e50eb Author: PySimpleSQL <[email protected]> Date: Mon Apr 17 11:04:31 2023 -0400 refs #281, Pandas partially working Sorting code moved into DataSet. Still some work to do, but very close to being functional again commit a529690 Author: PySimpleSQL <[email protected]> Date: Mon Apr 17 08:09:36 2023 -0400 refs #281, Pandas partially working Worked towards getting rid of ResultSet entirely and having SQLDriver.execute() returning DataFrames directly with the appropriate attrs set commit c6a8983 Author: PySimpleSQL <[email protected]> Date: Sun Apr 16 19:30:53 2023 -0400 refs #281 Pandas integration A little closer now. New records insert and mark as virtual. There was an issue with using .applymap on DataSet.rows, as .applymap returns a Dataset object directly, which was overwriting the ResultSet object. This fixes that issue. Still more to go, but another step closer commit 0cb39be Author: ssweber <[email protected]> Date: Sun Apr 16 15:12:18 2023 -0400 Properly insert series back into dataframe This fixes it adding that extra column. commit d1f11bd Author: PySimpleSQL <[email protected]> Date: Sun Apr 16 08:15:41 2023 -0400 refs #281, Pandas partially working More cleanup and experimentation. There is an issue with saving where sometimes the dict gets an extra key "0" and the update query fails. Also, even at times that the query goes through, the DataSet does not seem to update immediately to show the difference commit 0cc1f13 Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 20:09:17 2023 -0400 refs #281, Pandas partially working More cleanup commit bf017ab Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 18:02:33 2023 -0400 refs #281, Pandas partially working Lots of cleanup to do yet! commit 97e3686 Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 16:00:21 2023 -0400 refs #281, getting a start on converting over to Pandas for ResultSets more conversions commit e9e9190 Merge: 70171b6 dedb62a Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 15:07:02 2023 -0400 Merge branch 'pytest' into pandas commit dedb62a Merge: d494d67 d29cfc0 Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 15:05:30 2023 -0400 Merge branch 'development' into pytest # Conflicts: # pysimplesql/pysimplesql.py commit 70171b6 Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 04:25:15 2023 -0400 refs #281, getting a start on converting over to Pandas for ResultSets Got it pretty close to working (at least for the sqlite driver). More debugging and troubleshooting to go! commit d494d67 Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:47:23 2023 -0400 refs #278 fix ruff errors adding # ruff: noqa to test files commit cfd3fd7 Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:38:08 2023 -0400 refs #278 fix ruff error Ignore another SIM102 error. This one would be much messier to combine the if statements. Looks like the .ruffignore is not working either! commit f66000c Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:35:41 2023 -0400 refs #278 fix ruff error Ignore another SIM102 error. This one would be much messier to combine the if statements. Looks like the .ruggignore is not working either! commit d504891 Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:31:29 2023 -0400 refs #278 fix ruff error Fixed a SIM102 error flagged by ruff. This commit should also test if the .ruffignore file is working... commit 8191b8f Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:25:21 2023 -0400 refs #278 Unit Tests ruff ignore add a .ruffignore file to ignore the /tests folder commit 61fc8ec Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:21:17 2023 -0400 refs #278 Unit Test example for ProgressAnimate Finished up ProgressAnimate testing file along with improvments to bulletproof ProgressAnimate commit 7a97927 Merge: 65239d9 2d6938f Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 00:23:56 2023 -0400 refs #278 Unit Test example for ProgressAnimate Not perfect yet, but shows the basic concepts of testing for both no failures and expected failures. I tried to fix things in ProgressAnimate as I went along so that hopefully you can see the correlation between what was being tested, and the fixes that went in to pass the tests. If you haven't used pytest before, there's a few things to do: - pip install pytest - make sure pysimplesql is reachable as a module. The easiest way is to do a local installation by running `pip -e .` in the pysimplesql root directory - from the commandline, run `pytest` to run all tests. Or you can run tests for a specific file, I.e. `pytest progressanimate_test.py`
commit 35f8bf3 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 11:36:03 2023 -0400 Fixes lastrowid not being returned correctly in duplicate Old code was trying to get the lastrowid after the entire list of queries ran, which would return None due to the insert being buried in the list of queries. We now grab it after the insert runs by chacking if it has been set yet, and if the result has a lastrowid commit 9628f65 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 11:29:31 2023 -0400 refs #281 MSAccess fixes Small fixes / ruff fixes commit 3f24c38 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 11:23:28 2023 -0400 refs #281 MSAccess fixes Duplicate now working. DROP TABLE IF EXISTS does not seem to work reliably through Jackcess, so added a workaround. The lastrowid was not being returned due to the nature of the executing a list of queries, so grabbed the inserted id after all of the queries were finished. commit f904950 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 10:26:48 2023 -0400 refs #281 MSAccess fixes Duplicate now mostly working (selects wrong item after duplicate still). Had to remove quote_table stuff from the driver, as the variable is used in other places that do not expect it to be quoted - it's not needed anyway, as this is specific driver code and not generalized for all SQLDrivers commit c53caa7 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 09:39:31 2023 -0400 refs #281 MSAccess fixes override insert_record - Jackcess does not like columns set to None commit 2179061 Author: PySimpleSQL <[email protected]> Date: Fri Apr 21 09:26:28 2023 -0400 refs #281 Pandas integration resolved a small merge conflict commit 3ff3385 Author: PySimpleSQL <[email protected]> Date: Thu Apr 20 15:58:42 2023 -0400 refs #281, Got a little bit of MSAccess working Duplicate still broken. Out of time to look at it for now commit fc134c3 Merge: 87e9fac 456c5a7 Author: PySimpleSQL <[email protected]> Date: Thu Apr 20 15:58:29 2023 -0400 Merge remote-tracking branch 'origin/pandas' into pandas # Conflicts: # pysimplesql/pysimplesql.py commit 87e9fac Author: PySimpleSQL <[email protected]> Date: Thu Apr 20 15:55:12 2023 -0400 refs #281, Got a little bit of MSAccess working Duplicate still broken. Out of time to look at it for now commit 456c5a7 Author: ssweber <[email protected]> Date: Thu Apr 20 15:48:17 2023 -0400 black commit 3c78b07 Author: ssweber <[email protected]> Date: Thu Apr 20 15:47:51 2023 -0400 Sqlserver conversions still need to do sqlserver pk_column... didn't have time to start up docker to test how that get returned commit a465cd4 Author: ssweber <[email protected]> Date: Thu Apr 20 15:43:42 2023 -0400 More Result.set conversions Access has issue with save and duplicate commit 204842b Author: PySimpleSQL <[email protected]> Date: Thu Apr 20 11:46:07 2023 -0400 refs #281, Flatfile fixes Small fixes to Flatfile driver to work with pandas commit 2030c32 Author: ssweber <[email protected]> Date: Wed Apr 19 16:15:07 2023 -0400 Safeguard error if query somehow fails commit e5e1918 Author: ssweber <[email protected]> Date: Wed Apr 19 15:39:32 2023 -0400 Reverting line change I think both work correctly, so I'll just keep the one you wrote :) commit 10427c8 Author: ssweber <[email protected]> Date: Wed Apr 19 15:16:26 2023 -0400 Working mysql/postgres sql drivers Also fixed duplicate button always disabled Found other places where we needed to look at attrs instead of result.exception commit 9d86d1b Author: ssweber <[email protected]> Date: Wed Apr 19 13:54:40 2023 -0400 Update pysimplesql.py commit b7db10f Author: ssweber <[email protected]> Date: Wed Apr 19 13:53:33 2023 -0400 Fix for quick_editor, save_record Now with updated sqlite driver, this needed to update attrs commit f26c5b4 Author: ssweber <[email protected]> Date: Tue Apr 18 16:47:03 2023 -0400 Fixed checking for TableHeading I think this fixes the quick-editor commit 6a256a3 Author: ssweber <[email protected]> Date: Tue Apr 18 16:23:23 2023 -0400 Update pysimplesql.py commit 454a766 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 15:25:14 2023 -0400 refs #281, set_by_pk improvements There were certain situations where set_by_pk would fail if the primary key was not found (like after deleting a virtual record.). This ensures that an index will be selected even if the pk value is not found commit 7f159d8 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 15:18:35 2023 -0400 refs #281, set_by_pk improvements There were certain situations where set_by_pk would fail if the primary key was not found (like after deleting a virtual record.). This ensures that an index will be selected even if the pk value is not found commit b84643d Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 14:34:25 2023 -0400 refs #281, Purge virtual working DataSet.purge_virtual is now working. Also added some pandas display options for easier debugging commit 3ebcd20 Merge: 149bdc7 749c717 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 12:49:42 2023 -0400 Merge pull request #288 Moved things from _SortCallbackWrapper to sort commit 149bdc7 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 12:47:36 2023 -0400 refs #281, Duplicate record working oops, forgot something commit 749c717 Author: ssweber <[email protected]> Date: Tue Apr 18 12:31:24 2023 -0400 Update pysimplesql.py commit db4030d Author: ssweber <[email protected]> Date: Tue Apr 18 12:28:07 2023 -0400 Update pysimplesql.py commit aa7c8ac Author: ssweber <[email protected]> Date: Tue Apr 18 12:27:04 2023 -0400 Move from _SortCallbackWrapper to sort commit 32266f1 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 12:20:38 2023 -0400 refs #281, Duplicate record working Duplicating records working once again commit 28118ed Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 12:04:34 2023 -0400 refs #281, Sorting by foreign keys Sorting for foreign keys works again. A temporary column is added that maps the fk to the description column of the parent table, the dataset is sorted on this temporary column, then the temporary column is dropped in place. commit caa0754 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 11:03:10 2023 -0400 refs #281, Record search working again Searching for records works as expected again commit ccabe70 Author: PySimpleSQL <[email protected]> Date: Tue Apr 18 10:01:56 2023 -0400 refs #281, Pandas more cleanup Cleaned up a lot of the ResultSet references that are no longer valid now that we are working with DataFrames. Changed the set_by_pk call to update_elements, otherwise the navigation buttons don't update after sorting commit 25e5495 Author: ssweber <[email protected]> Date: Tue Apr 18 00:19:37 2023 -0400 fixes navigation buttons being wrong commit b7f7051 Author: ssweber <[email protected]> Date: Tue Apr 18 00:09:37 2023 -0400 Lots of fixes I think this gets us almost all the way there. in insert_row, setting the idx is not implemented yet Also, ruff is complaining about: F405: 'ResultSet' may be undefined ... but I didn't know what to replace that with. commit a9928e5 Author: ssweber <[email protected]> Date: Mon Apr 17 20:36:40 2023 -0400 small fix you're right, somethings still borked with sorting. sorry, this at least gets it in a workable state. commit 50e7430 Author: ssweber <[email protected]> Date: Mon Apr 17 17:08:48 2023 -0400 fixes commit 76b4835 Author: PySimpleSQL <[email protected]> Date: Mon Apr 17 15:48:42 2023 -0400 refs #281, Pandas partially working Pretty big step backwards with this one. Working on cleaning up the sorting code had some unexpected consequences. I'm out of time for a while, so checking this in for now commit 0a77f5e Author: PySimpleSQL <[email protected]> Date: Mon Apr 17 12:43:31 2023 -0400 refs #281, Pandas partially working Sorting code working. Still need to work out how to sort FK relationships by their description column commit e3e50eb Author: PySimpleSQL <[email protected]> Date: Mon Apr 17 11:04:31 2023 -0400 refs #281, Pandas partially working Sorting code moved into DataSet. Still some work to do, but very close to being functional again commit a529690 Author: PySimpleSQL <[email protected]> Date: Mon Apr 17 08:09:36 2023 -0400 refs #281, Pandas partially working Worked towards getting rid of ResultSet entirely and having SQLDriver.execute() returning DataFrames directly with the appropriate attrs set commit c6a8983 Author: PySimpleSQL <[email protected]> Date: Sun Apr 16 19:30:53 2023 -0400 refs #281 Pandas integration A little closer now. New records insert and mark as virtual. There was an issue with using .applymap on DataSet.rows, as .applymap returns a Dataset object directly, which was overwriting the ResultSet object. This fixes that issue. Still more to go, but another step closer commit 0cb39be Author: ssweber <[email protected]> Date: Sun Apr 16 15:12:18 2023 -0400 Properly insert series back into dataframe This fixes it adding that extra column. commit d1f11bd Author: PySimpleSQL <[email protected]> Date: Sun Apr 16 08:15:41 2023 -0400 refs #281, Pandas partially working More cleanup and experimentation. There is an issue with saving where sometimes the dict gets an extra key "0" and the update query fails. Also, even at times that the query goes through, the DataSet does not seem to update immediately to show the difference commit 0cc1f13 Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 20:09:17 2023 -0400 refs #281, Pandas partially working More cleanup commit bf017ab Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 18:02:33 2023 -0400 refs #281, Pandas partially working Lots of cleanup to do yet! commit 97e3686 Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 16:00:21 2023 -0400 refs #281, getting a start on converting over to Pandas for ResultSets more conversions commit e9e9190 Merge: 70171b6 dedb62a Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 15:07:02 2023 -0400 Merge branch 'pytest' into pandas commit dedb62a Merge: d494d67 d29cfc0 Author: PySimpleSQL <[email protected]> Date: Sat Apr 15 15:05:30 2023 -0400 Merge branch 'development' into pytest # Conflicts: # pysimplesql/pysimplesql.py commit 70171b6 Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 04:25:15 2023 -0400 refs #281, getting a start on converting over to Pandas for ResultSets Got it pretty close to working (at least for the sqlite driver). More debugging and troubleshooting to go! commit d494d67 Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:47:23 2023 -0400 refs #278 fix ruff errors adding # ruff: noqa to test files commit cfd3fd7 Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:38:08 2023 -0400 refs #278 fix ruff error Ignore another SIM102 error. This one would be much messier to combine the if statements. Looks like the .ruffignore is not working either! commit f66000c Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:35:41 2023 -0400 refs #278 fix ruff error Ignore another SIM102 error. This one would be much messier to combine the if statements. Looks like the .ruggignore is not working either! commit d504891 Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:31:29 2023 -0400 refs #278 fix ruff error Fixed a SIM102 error flagged by ruff. This commit should also test if the .ruffignore file is working... commit 8191b8f Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:25:21 2023 -0400 refs #278 Unit Tests ruff ignore add a .ruffignore file to ignore the /tests folder commit 61fc8ec Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 01:21:17 2023 -0400 refs #278 Unit Test example for ProgressAnimate Finished up ProgressAnimate testing file along with improvments to bulletproof ProgressAnimate commit 7a97927 Merge: 65239d9 2d6938f Author: PySimpleSQL <[email protected]> Date: Fri Apr 14 00:23:56 2023 -0400 refs #278 Unit Test example for ProgressAnimate Not perfect yet, but shows the basic concepts of testing for both no failures and expected failures. I tried to fix things in ProgressAnimate as I went along so that hopefully you can see the correlation between what was being tested, and the fixes that went in to pass the tests. If you haven't used pytest before, there's a few things to do: - pip install pytest - make sure pysimplesql is reachable as a module. The easiest way is to do a local installation by running `pip -e .` in the pysimplesql root directory - from the commandline, run `pytest` to run all tests. Or you can run tests for a specific file, I.e. `pytest progressanimate_test.py`
I checked all the sql drivers. The only issues I saw revolves around duplicate... either not jumping to the correct row, or like sqlserver, which needs a duplicate rewrite. Maybe there's a more database-agnostic way to accomplish this than the the hack I found on stackoverflow. At any rate, all the duplicate problems existed before pandas. So I'm cool if you want to merge this back in! |
Chatgpt and I rewrote duplicate. I realized columninfo had all the information I needed! I’ll go back and comment more, but this avoids all the silliness of temp-tables. it’s now working on sqlserver. I’ll double-check MySQL and Postgres. Maybe we don’t need a separate one for msaccess? |
There may still be an issue with MSAccess that prevents a generalized
solution - DROP TABLE IF EXISTS does not seem to work. I messed with it
for quite a while one day
…On Wed, Apr 26, 2023, 5:08 PM ssweber ***@***.***> wrote:
Chatgpt and I rewrote duplicate. I realized columninfo had all the
information I needed!
I’ll go back and comment more, but this avoids all the silliness of
temp-tables.
it’s now working on sqlserver. I’ll double-check MySQL and Postgres.
Maybe we don’t need a separate one for msaccess?
—
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQX2REVFUEXNIJULB7ZKD3LXDGFGRANCNFSM6AAAAAAW4YNJ64>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yeah, hopefully this is more general-purposed. It uses for children, it again uses column_info, but importantly, when selecting columns, sets the fk_column to equal the new parent pk before inserting. no create/drop necessary :) ———- it’s been a real pleasure this last week discovering and using some of the gems 💎 you have written. I used column_info to infer checkboxes, and ElementRow for combobox es in the CellEdit logic. |
Nice! Yeah, that is a much better approach!
…On Wed, Apr 26, 2023, 8:59 PM ssweber ***@***.***> wrote:
Yeah, hopefully this is more general-purposed.
It uses Dataset.column_info to select all the columns except the
pk_column and copies the row right in the same table.
for children, it again uses column_info, but importantly, when selecting
columns, sets the fk_column to equal the new parent pk before inserting.
no create/drop necessary :)
———-
it’s been a real pleasure this last week discovering and using some of the
gems 💎 you have written. I used column_info to infer checkboxes, and
ElementRow for combobox es in the CellEdit logic.
—
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQX2REUJ7POMQFADZPWFAIDXDHAIBANCNFSM6AAAAAAW4YNJ64>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I hope this looks good to you. Now completely functional on all sqldrivers, and they select the correct pk afterwords! Since sqlserver and msaccess only needed minor changes, I split out into functions: get_duplicate_parent_query(self, table, columns, pk_column, current_pk) get_duplicate_parent_new_pk(self, res, pk_column)
I cleaned that up and tested on all sqldrivers. Works perfectly. I hope it looks OK to you. Is there anything left for us to do before merging pandas in? |
I'm still wondering if we should switch to using pandas .index vs. a
numerical index (loc[ ] vs iloc [ ]). The .index would need reset on
sorts, but the rest would be a little cleaner and easier to understand.
What are your thoughts?
Thanks for your work on this. I'm in an RV right now on a trip- 8bwas
hoping to be able to get some work done, but it's just been too chaotic!
…On Thu, Apr 27, 2023, 11:04 AM ssweber ***@***.***> wrote:
I cleaned that up and tested on all sqldrivers. Works perfectly. I hope it
looks OK to you.
Is there anything left for us to do before merging pandas in?
—
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQX2RESZI4IFKD6MR2EXQ2LXDKDIBANCNFSM6AAAAAAW4YNJ64>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I may not understand this well. Are you considering set_index the pk_column? Then iloc[1] would grab the pk=1 i think that removing the auto-created index would be a plus, and more expected. |
That's not quite what I meant, but that's another option as well- indexes
can be set to just about anything in pandas.
Whether it's a number from 0 to x, or a pk. Most methods in pandas assume
that the .index property is being used. however, we are working with the
numerical index, similar to a list- and they are very hard and confusing in
pandas - especially since the .index property is a separate thing
altogether, and isn't necessarily a numerical integer index.
If we do use the .index property, we should probably use it as a numerical
index, since DataSet.current_index already operates this way.
…On Thu, Apr 27, 2023, 11:50 AM ssweber ***@***.***> wrote:
I may not understand this well. Are you considering set_index the
pk_column? Then iloc[1] would grab the pk=1
i think that removing the auto-created index would be a plus, and more
expected.
—
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQX2RER6FW3QOPFODJ73VT3XDKIU5ANCNFSM6AAAAAAW4YNJ64>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'll have to see what you mean to understand 😅 But you're typically have a good feel for these things! |
Is it worth merging in as-is (it's at a high-level of functionality now) and then working on the iloc to .index transition in a pandas.index branch? That way I can rebase _EditCell on development, there are a few rough edges on it yet. |
Actually, disregard previous. Take your time thinking about it - enjoy your trip. This isn't holding me up smoothing out _EditCell (I need to stop procrastinating with my actual day-job work!) |
Good idea. Yeah, let's do that
…On Thu, Apr 27, 2023, 2:14 PM ssweber ***@***.***> wrote:
Is it worth merging in as-is (it's at a high-level of functionality now)
and then working on the iloc to .index transition in a pandas.index branch?
That way I can rebase _EditCell on development, there are a few rough
edges on it yet.
—
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQX2REQGAPFWPO7E5VHTV7TXDKZSFANCNFSM6AAAAAAW4YNJ64>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
alright! |
I've been kicking this around for a while. ResultSets and therefore the dataset rows extend simple lists. Pandas would be a much more powerful option.
This is more of a long term goal, but I wanted to at least get it in the system
The text was updated successfully, but these errors were encountered: