I have a simple function that inserts objects to MySQL (with Peewee ORM), it works perfectly on my pc and in the Python Anywhere console too, but unfortunately if I try to run the same file as a scheduled task, I'm getting an error like this:
tablename.insert_many(objdict).execute()
AttributeError: type object tablename' has no attribute 'insert_many'
Since my implementation runs without any problems from the PA console, I'm sure it's something related to the sceduled tasks, but I have no idea what can cause the problem. I would really appreciate if somebody could help me to figure out what's wrong.
The method that crashes (at scheduled tasks) looks like this:
def uploadObject (objDict):
tablename.insert_many(objDict).execute()