-
Notifications
You must be signed in to change notification settings - Fork 9
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
Value of unknown type: <class 'decimal.Decimal' #2
Comments
Hello, I have the same problem with MySQL database
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: Value of unknown type: <type 'exceptions.TypeError'>, Value of unknown type: <class 'decimal.Decimal'>, 52166.10 Manually:
|
I found casting INT column results to CHAR type works: |
I see this is pretty old but I ran into this issue and found a fix for it so I thought I'd post it up. Basically the error is from the ansible module trying to convert the sql output to json. I think this happens in the As a fix, instead of letting ansible try to convert the python object to json, I converted it to json myself. so something like: query_result = cursor.fetchall()
result = json.dumps(query_result, default=str) that should cover any non json-able data types like decimal, datetime, etc. |
Using below query fails.
Executing the query manually produces no error. Seems that the module does not support decimal datatypes in the output.
The text was updated successfully, but these errors were encountered: