coleifer / peewee

a small, expressive orm -- supports postgresql, mysql, sqlite and cockroachdb
http://docs.peewee-orm.com/
MIT License
11.09k stars 1.37k forks source link

peewee.ProgrammingError: Error binding parameter 1: type 'builtin_function_or_method' is not supported #2693

Closed RanjithSivam closed 1 year ago

RanjithSivam commented 1 year ago

I am trying to update. I get this error.

My Code: image

Here is the error: Traceback (most recent call last): File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3236, in execute_sql cursor.execute(sql, params or ()) sqlite3.ProgrammingError: Error binding parameter 1: type 'builtin_function_or_method' is not supported

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\eel__init.py", line 318, in _process_message
return_val = _exposed_functionsmessage['name'] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\personal\Shoonya\start.py", line 39, in loginDefault dbHelper.updateLastLogin() File "E:\personal\Shoonya\lib\db.py", line 63, in updateLastLogin Credential.update(last_login=datetime.datetime.now).where(Credential.is_default == True).execute() File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 1962, in inner return method(self, database, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 2033, in execute return self._execute(database) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 2551, in _execute cursor = database.execute(self) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3244, in execute return self.execute_sql(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3234, in execute_sql with __exception_wrapper
: File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3010, in exit reraise(new_type, new_type(exc_value, exc_args), traceback) File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 192, in reraise raise value.with_traceback(tb) File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3236, in execute_sql cursor.execute(sql, params or ()) peewee.ProgrammingError: Error binding parameter 1: type 'builtin_function_or_method' is not supported Traceback (most recent call last): File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\gevent_ffi\loop.py", line 270, in python_check_callback def python_check_callback(self, watcher_ptr): # pylint:disable=unused-argument ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 2033, in execute return self._execute(database) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 2551, in _execute cursor = database.execute(self) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3244, in execute return self.execute_sql(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3234, in execute_sql with __exception_wrapper: File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3010, in exit__ reraise(new_type, new_type(exc_value, exc_args), traceback) File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 192, in reraise raise value.with_traceback(tb) File "C:\Users\ranjith-15557\AppData\Local\Programs\Python\Python311\Lib\site-packages\peewee.py", line 3236, in execute_sql cursor.execute(sql, params) peewee.ProgrammingError: Error binding parameter 1: type 'builtin_function_or_method' is not supported

coleifer commented 1 year ago

Do not post questions like this on here. Post your questions on stack overflow. The error is extremely basic, and the error message tells you what is going on. You cannot pass a function as a query parameter.

# Actually call .now(), don't pass the function itself:
.update(last_login=datetime.datetime.now())