Ticket #40434

KeyError: <class 'decimal.Decimal'> in execsql.py on line 3584 of execsql.
Open Date: 2020-05-21 21:16 Last Update: 2020-05-30 18:27

Reporter:
(Anonymous)
Owner:
(None)
Type:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
None

Details

I'm trying to use the COPY QUERY metacommand to add the results from a query on the originating database (MariaDB) to the destination database (SQLServer). The query is correct, since I've been able to dump its content to stdout using execsql. However, turns out the destination database is using a field of type money (https://docs.microsoft.com/en-us/sql/t-sql/data-types/money-and-smallmoney-transact-sql?view=sql-server-ver15) which execsql seem to not understand, and so it fails when trying to map data to that type.

Ticket History (3/5 Histories)

2020-05-21 21:16 Updated by: None
  • New Ticket "KeyError: <class 'decimal.Decimal'> in execsql.py on line 3584 of execsql." created
2020-05-21 21:47 Updated by: None
Comment

I was able to fix this by adding self.dt_castDecimal = DT_Decimal().from_data to execsql.py after line 3490, with the code now looking as:

self.encoding = encoding or 'latin1' # Default on installation of SQL Server self.dt_castDecimal = DT_Decimal().from_data self.encode_commands = True self.paramstr = '?'

2020-05-22 00:20 Updated by: rdnielsen
Comment

Thanks. The general solution is to specify that cast in the Database class; I will make that change.

2020-05-22 12:44 Updated by: rdnielsen
  • Resolution Update from None to Fixed
  • Status Update from Open to Closed
Comment

Fixed in 1.73.3.

2020-05-30 18:27 Updated by: None
Comment

Thank you very much!

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login