Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error when dealing with uuid
#1
I have this sql statement and it gives me error: Unknown column 'guid' in 'NEW' mysql

SQL Statement in python: INSERT INTO user (username, userpassword , admin) VALUES (%s, %s, %s )

Table structure is:
userid
username
userpassword
userguid
admin

userid is auto increment
userguid is uuid() function
Reply
#2
You will have to show more of your program. And show the complete error message. The error you mention does not originate from the insert statement you show us.
Reply
#3
(Apr-11-2021, 09:42 AM)ibreeden Wrote: You will have to show more of your program. And show the complete error message. The error you mention does not originate from the insert statement you show us.
I am only getting this error message posted. It doesn’t tell me anything else. I tried running this statement inside of MySQL and from python it gives me the same errors.
Reply
#4
(Apr-11-2021, 09:42 AM)ibreeden Wrote: You will have to show more of your program. And show the complete error message. The error you mention does not originate from the insert statement you show us.
I am only getting this error message posted. It doesn’t tell me anything else. I tried running this statement inside of MySQL and from python it gives me the same errors.
Reply
#5
(Apr-10-2021, 02:07 PM)vj78 Wrote: userguid is uuid() function
Where and how is the uuid() function defined? Please show us the code.
Reply
#6
(Apr-11-2021, 11:52 AM)ibreeden Wrote:
(Apr-10-2021, 02:07 PM)vj78 Wrote: userguid is uuid() function
Where and how is the uuid() function defined? Please show us the code.

Ok, I am 1 step further. There was a trigger that got created by default while creating this uuid or guid field. I deleted that trigger now it is inserting rows using the MySQL sql prompt screen.

The UUID function just inserts UUID() as a string inside of the userguid column. So, it’s not working as planned. I will post a print screen of how I created it.
Reply
#7
(Apr-11-2021, 02:39 PM)vj78 Wrote:
(Apr-11-2021, 11:52 AM)ibreeden Wrote: Where and how is the uuid() function defined? Please show us the code.

Ok, I am 1 step further. There was a trigger that got created by default while creating this uuid or guid field. I deleted that trigger now it is inserting rows using the MySQL sql prompt screen.

The UUID function just inserts UUID() as a string inside of the userguid column. So, it’s not working as planned. I will post a print screen of how I created it.

[Image: image-22.png.webp]

I am going into the mysql admin panel. I select the database and then the table from left hand navigation. Then click add column.

[Image: Add-New-Column.png]

In here, I am add the name, varchar, length 100, and selecting defined from default column and enter uuid().
Reply
#8
Question now is how to use UUID function?
Reply
#9
You could of course also implement this function in Python. But the question is: what does the function do? Can you find the text of the trigger?
vj78 likes this post
Reply
#10
(Apr-11-2021, 06:14 PM)ibreeden Wrote: You could of course also implement this function in Python. But the question is: what does the function do? Can you find the text of the trigger?
Yes, I think I should implement this function in Python instead.
The function is supposed to generate a GUID which is a unique id.
I deleted the old one that was causes the error. Now, I wish I could recover it to see how it was build.
I am trying to build this new trigger:

INSERT INTO user
SET action = 'insert',
user.userguid = UUID()
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020