Data entry

When I enter (command line) pihole -w ipinfo.io, two database entries are created, one in table domainlists and another in table domainlist_by_group. I expected this entry to go in the table whitelist, that is obviously NOT the case.

  • What are the different tables used for?
  • Is the whitelist table still used?
  • It appears to be possible to add adlists, whitelist, ... entries, using sqlite3 I'm using (example):
sudo sqlite3 /etc/pihole/gravity.db
insert into adlist (address) values ("https://dbl.oisd.nl");
.quit

The goal of course is to automate - add multiple entries, using a script (sudo sqlite3 /etc/pihole/gravity.db < /home/pi/tmp/adlists.sql), the script as follows:

CREATE TEMP TABLE i(txt);
.separator ~
.import /home/pi/tmp/adlists.list i
INSERT OR IGNORE INTO adlist (address) SELECT txt FROM i;
DROP TABLE i;

Thank you for your time and effort.

I don't think those tables are used at all, they are populated with data from old text files and that's it...

All that matters is "domainlist" table.

Tested this in VM and it seems even if you add entry to those tables and regenerate gravity they are not added.

If these tables aren't used, they should be removed.
I don't think the developers would leave obsolete tables in the database, there are already 9 revisions to the database structure, see folder /etc/.pihole/advanced/Scripts/database_migration/gravity/, so this appears to be well maintained...

@DL6ER: your input would be much appreciated

Thanks for your time and effort

Thanks for pointing this out. Deleting these databases was indeed missed in the 3->4 upgrade process, I will add it now.

1 Like

I just ran pihole -up, new core and FTL. The database version still appears to be version 9.
correct? forgotten? not ready yet?

How can we be sure we're really running the latest beta version, apart from running pihole -up regularly. A sticky topic with the commands, required to get the latest and greatest would be an idea, this to keep the testers motivated...

Thanks for your time and effort.

Yes. When you follow the link to the PR you can see it hasn't been reviewed and merged yet.

There isn't anything you need to or really can do besides running pihole -up. I doubt we will add many more features. If everything is working well for you, you can happily use the beta now. If you have an issue, we will tell you when updating will make a difference :wink:

Maybe you can watch the Github repositories, that's the best source for information and also something that cannot be forgotten to update.

1 Like

I've applied your update script manually, the obsolete tables appear to be removed. Is it correct to assume pihole-FTL only uses the views?

In my case I wrote a script to automate pulling remote lists.

It disables entries that got removed in the remote list and does not touch anything but entries added by itself. (Uses comment field)

Yes. They are a convenient way to read only the enabled entries. Furthermore, for domains, they also do the filtering by domain type so you don't have to remember what type regex whitelist, etc. is.