MySQL Forums
Forum List  »  General

Re: Able to run statement in CLI and return a correct value but when run in a script it returns None
Posted by: Peter Brawley
Date: November 01, 2021 11:22AM

Apologies, on first read I missed two likely problems ...

> WHERE Token = '" + (data['data'][coin]['symbol'] + "'")

1 The first double quote encloses nothing, the second encloses a single quote. That should generate a MySQL syntax error.

2 In MySQL, the + operator does not concatenate strings, it just adds numeric values. You need to use Concat(). eg ...

... WHERE Token = concat( ''", data['data'][coin]['symbol'], "'") ...

If the Python code had included error-trapping code, you might've seen a useful error or warning msg.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.