Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

MySQLdb._exceptions.ProgrammingError: execute() first #2

Open
Marow opened this issue Dec 5, 2020 · 5 comments
Open

MySQLdb._exceptions.ProgrammingError: execute() first #2

Marow opened this issue Dec 5, 2020 · 5 comments

Comments

@Marow
Copy link

Marow commented Dec 5, 2020

I get that error when try to login...

MySQLdb._exceptions.ProgrammingError: execute() first

@vlori2k
Copy link

vlori2k commented Feb 4, 2021

I get the same.. somebody could please help ?

@SanderWegter
Copy link
Owner

Hi

Apologies for the lack of response.

Have you tried to edit the following bit:

https://github.com/Madpilot0/FlaskDashboard/blob/master/lib/Database.py#L32

And add prints for the sql and arguments to determine where the sql error lies.

			except MySQLdb.Error as e:
				print(e)
                                print(f"Query: {sql}")
                                print(f"Args: {str(args)}")

I'm currently not actively maintaining this project but in the future I'll probably make an updated version with better error handling.

@SanderWegter
Copy link
Owner

Yes, but i was curious about the output ;-) Printing the messages won't fix the issue. I'm trying to see if I could quickly help you.

@vlori2k
Copy link

vlori2k commented Feb 4, 2021

Seems that the error comes from the database/SQL side:

(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups G ON G.id = M.gid WHERE user = 'admin'' at line 1") Query: SELECT pass,firstname,lastname, G.name FROM users LEFT JOIN groupmembers M ON M.uid = id LEFT JOIN groups G ON G.id = M.gid WHERE user = %s Args: ['admin'] [2021-02-04 11:24:01,878] ERROR in app: Exception on /login [POST]

@SanderWegter
Copy link
Owner

Ah, my best guess is that at the time of writing this I used MySQL 5.something. The latest version is (I think) 8.X which has some more reserved words. 'Groups' is one of those.

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

No branches or pull requests

3 participants