-
Notifications
You must be signed in to change notification settings - Fork 71
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
whotracks.me/whotracksme/data/assets/trackerdb.sql -> sqlite3 error #277
Comments
did some tests. apparently, the version of sqlite3, used to create trackersdb.sql (.dump ???) creates a script, that isn't compatible with the latest version of sqlite3. This would mean you need to install a more recent (latest) version of sqlite3 on the system, used to create the script. |
Thanks for reporting. I have some difficulties to reproduce though. I'm able to create a database from the sql when testing with sqlite 3.38.5 (on Arch). This is what I tried:
So, on the latest sqlite3 version, it seems to work. |
Thanks for looking at this, difficult, since there are 3 parties involved (you, me and the pihole-FTL developpers). I'm trying to keep everybody in the loop, and reported your findings and my additional test here. Will get back to you as soon as possible. |
You should be able to reproduce by including Your current code seems to assume foreign key constraints are not enforced by the database engine. Different SQLite3 versions may use either You could consider to run the statements in an order that would comply with foreign key constraints. Alternatively, if you are sure that execution would never result in any foreign key violations, and if your SQL would target SQLite3 only, you could also include the respective PRAGMA statements in your script. |
Yes, when adding that, it fails with such errors:
|
For changing the order of SQL statements, you could take a peek at yubiuser's suggestion from https://discourse.pi-hole.net/t/interesting-study-leaky-forms/55401/4 |
I do agree that this should be changed in your script.
(https://www.sqlite.org/foreignkeys.html) And in your case, it isn't even necessary to deal with foreign keys at all. Just change the order of the commands to ensure you are not referencing something which does not exist at this time. Create parents before children (please follow @Bucking-Horn's link for a clear explanation). It'd be better if the script is already prepared for this (especially because the fix is simple and easy). |
Looked at, but it is unfortunately it is hard to change the order. It is not that we generate the SQL directly; it comes indirectly by dumping an already existing sqlite database with https://pypi.org/project/sqlite-dump/ The code does something like that:
I'm currently not aware of an elegant way to fix the order without rewriting the whole exporter. For the moment, the best workaround that I can see is to import it with |
We recently opened all the data: https://github.com/ghostery/trackerdb. It's now the recommended place to start and will replace the trackerdb.sql file in this repository (#315). In trackerdb releases, we export the data in different formats. There is an sqlite binary dump (trackerdb.db), but perhaps the You can find the latest releases here: @DL6ER @Bucking-Horn @jpgpi250 If you have any feedback, please let us know (either here or open a ticket on https://github.com/ghostery/trackerdb/issues). |
Using the latest version of sqlite3, the database cannot be build from the sql script.
this has been discussed here, non working and working example included. It appears older sqlite3 versions ignore the error, the latest version apparently has a problem with it.
For clarification, using the debian bullseye version 3.34.1-3 ignores the problem, pihole-FTL has the latest version (3.38.2) of sqlite3 embedded, this version does show the problem.
Whould it be possible to update the sql script to allow newer versions of sqlite3 process the script without errors.
Thanks for your time and effort.
The text was updated successfully, but these errors were encountered: