Skip to content
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

SQL Lookup Tables will not initialize #70

Open
sourlace opened this issue Jul 29, 2022 · 1 comment
Open

SQL Lookup Tables will not initialize #70

sourlace opened this issue Jul 29, 2022 · 1 comment

Comments

@sourlace
Copy link

sourlace commented Jul 29, 2022

Hello! Having issues with the setup, it looks like the channel crawler is trying to reference a value from the un-initialized channels table?

The only channel that populates is 'users', the subsequent SQL insertions all fail due to the tables not being initialized correctly. Is there a setup step I missed?
Log:

[INFO] statbot.event: Initializing SQL lookup tables...
[INFO] statbot.event: Processing X users...
[INFO] statbot.event: Processing X guilds...
[INFO] statbot.event:
[INFO] statbot.event: Ready!
[INFO] statbot.sql: Looking up channel crawl progress for {server} #{channel}
[INFO] statbot.sql: Inserting new channel crawl progress for {server} #{channel}
[ERROR] statbot.sql: Exception occurred in 'with' scope!
Traceback (most recent call last):
File ".../python3.9/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
self.dialect.do_execute(
File ".../python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.ForeignKeyViolation: insert or update on table "channel_crawl" violates foreign key constraint "channel_crawl_channel_id_fkey"
DETAIL: Key (channel_id)=(1002...) is not present in table "channels".

@sourlace
Copy link
Author

sourlace commented Aug 1, 2022

In case somebody runs into this same issue, a few things:

-> First, drop the psql DB, if you've already run the initialization script.
-> Second, comment out any mention of voice_region in the code (deprecated)
-> Third, I also needed to change
for guild in set(self.guilds) & set(self.config["guild-ids"]): (Line 171 in client.py)
to:
for guild in set(self.guilds):

-> Then I just repeat the psql setup, ran the bot command, and it ran perfectly

Happy to submit a PR to get statbot to work with modern discord.py, if this project is still maintained. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant