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
Supporting native backup facility of SQLite #71832
Comments
It would be nice if the sqlite3 stdlib module could expose the SQLite Online Backup API. I'm willing to implement it, as encouraged by Paul Moore. See also: https://mail.python.org/pipermail/python-dev/2016-July/145570.html |
Here is a preliminary implementation: lelit@b7456eb |
That's really nice, thank you for doing this! To get your code reviewed, though, you should upload a patch here. With git, you can do 'git diff > my_patch_file_name.patch' in your local repo, then you can upload the resulting file here. If you haven't done so yet, you'll need to sign a contributor agreement as well: https://www.python.org/psf/contrib/contrib-form/ :) (Also, you might want to remove the 'index ...' lines in the patch file that git generates for each modified file; since there are three files, there should be three lines to remove. I'm not sure if you really have to, but I always do it just to be sure :) |
Thanks for the patch! I haven't had a chance to review the patch yet, but we also need documentation updates to Doc/library/sqlite3.rst. |
For the documentation see lelit@bd82f8d or the attached patch. |
WRT to the agreement form, I guess I'll have to compile it even if I already contributed to Python decades ago (ObjC, readline, NeXT support...), right? Will try to do whatever is needed in the next days... |
If you have a copy of your original agreement you could fax it to the PSF, but it is probably easier to just to sign the electronic one. |
Ok, the agreement is fullfilled. |
I guess the chance of getting this merged before the 3.6 betas is very low, but if there is *anything* I could do to raise it, please tell :-) |
Now that we are is officially on GH, would you welcome a PR rebasing this patch on top of the master branch? |
I actually looked at the patch and have a few comments:
I am not a core developer but I think you should open the PR as it will be easier for the CR. |
Thank you Aviv, I applied your suggestions and opened a PR. |
Is there any chance this could be accepted for Python 3.7? |
There's a good chance, yes. You'll have to keep periodically pinging the issue (say once a month :), and if you can specifically talk someone into doing a review your chances go up :) For it to go in we need a review from a core-dev, but one or more reviews from non-core-devs will help it move along as well (less for the core-dev to do when they find the time to do the review). |
Monthly offer to do whatever is needed to easy the path to adoption :-) |
I rebased my v2 set of changesets into a new branch: https://github.com/lelit/cpython/tree/sqlite-backup-api-v3 I really don't know if anybody is interested beyond me, I did everything has been suggested/requested, and honestly I feel a bit discouraged: in the good'n'old days even potentially disrupting and invasive patches of mine have been accepted by the one&only core developer, now for an harmless, tested and documented single new feature an year and half has passed with almost no progress.... Anyway, I guess that this is my last attempt, let's hope... Let me know if I should close the PR#377 and reopen a new one, or whatever. |
If you are talking about Gerhard, if he was still around you'd probably get a similar response, but he hasn't been around much. So this is somewhat of an orphaned module currently and it takes longer for an issue to get traction. One of the drawbacks of the open-source-volunteer model :( |
I'm using sqlitebck which provides similar functionality but instead of using a file name to store the backup it uses connection instances. |
Reasonable and quite simple to implement: done in commit lelit@960303f |
As suggested by Brett Cannon, I closed the original PR#377 and opened a new one against a rebased version of the implementation. |
Just to keep the door open, I'm willing to to whatever is needed to see this accepted and merged. |
It seems to me that the code could be much simpler (and more bugfree) if support only a Connection instance as a target. It is easy to create a Connection instance in Python: with sqlite3.connect(filename) as dest:
source.backup(dest) But this would save around 50 lines of complex C code. And I'm not sure this code is correct. |
I need advice on Serhiy's proposal of dropping support to plain file name (see also #4238 (comment)). Wrt the other point I filed issue bpo-32274. |
I prefer to keep Connection.backup() simpler. Additional features can be implemented in pure Python. |
Thank you Serhiy, ok: will simplify the method, hopefully tomorrow. |
I suspect this won't land in 3.7... Let me know if I can do something to make that happen, or instead if I should try to rebase the change on top of current master and rectify references to the Python version. |
Thanks, Lele. Note that Ned gave his permission to get this into 3.7.0b3 at #4238 (comment) We can, of course, still revert it before 3.7.0 final. |
From http://buildbot.python.org/all/#/builders/13/builds/808 ====================================================================== Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-debian-z/build/Lib/sqlite3/test/backup.py", line 44, in test_bad_target_in_transaction
self.cx.backup(bck)
AssertionError: OperationalError not raised |
From test.pythoninfo: sqlite3.sqlite_version: 3.8.7.1 |
AppVeyor: sqlite3.sqlite_version: 3.21.0 (passed) Travis CI: sqlite3.sqlite_version: 3.8.2 (passed) http://buildbot.python.org/all/#/builders/88/builds/799 sqlite3.sqlite_version: 3.8.2 (passed) |
Test also passed on my MBP with SQLite 3.22.0 and the following line rc = _pysqlite_seterror(bck_conn, NULL); returns
with
Looging at https://www.sqlite.org/src/artifact?ln=on&name=faf17e60b43233c2, checkReadTransaction() returns
I've opened PR 6067 to skip the test under SQLite 3.8.7.1 for now. Lele, could you take a look at this please? It's almost 4 am here I won't be able to work on this in the next 10-15 hours. |
Sorry, I could not find an easy enough way to compile against SQLite 3.8.7.1, being on Debian sid myself (3.22). I hope to find some time to try harder. |
FYI, I will have some time to debug the test failure this weekend. If I (or Lele or someone else) can't find the problem by Monday, I'm going to revert the patch from 3.7 branch (and probably from master too) |
The problem is that change https://www.sqlite.org/src/info/169b5505498c0a7e was part of sqlite version 3.8.8 |
Thank you Berker&Aviv, I'm sorry I could not find the time to investigate the problem by myself. |
Buildbots look happy, closing this one as 'fixed'. Thanks, Aviv! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: