It is probably me who is misunderstanding something, but as I see it the data in ati.account is binary and needs to be converted (encoded) into something that can be compared to something else in order to use it in the query.
If the way to use the account address in a SQL statement is to represent it as a hex string, then I would assume that I would have to compare it to a hex encoded version of ati.account in the database in order to be able to compare these 2… or… what am I missing here?
Therefore I don’t understand the statement ati.account = ‘hex string’… Isn’t that like comparing apples to oranges (binary data to hex string)?
I still have had no luck getting any rows when I query for summaries with my account as criteria. Maybe there are no rows to be found, which would be very odd or maybe I’m just not providing the correct value to search for, which I find more plausible.
I have tried the following (to test both).
The first I would think was apples to apples (hex to hex):
SELECT A.id AS a_id, encode(A.account,'hex') AS a_hex,
S.id AS s_id, S.timestamp AS s_timestamp, S.summary AS s_summary
FROM ati A
JOIN summaries S ON A.summary = S.id
WHERE (encode(A.account,'hex') = '\x0139fc4ea5015885d50c7730852b4a9b2249aaf54f0abb8a8ec44b78776668')
ORDER BY S.timestamp DESC LIMIT 10;
And the second I would think was apples to oranges (binary to hex).
SELECT A.id AS a_id, encode(A.account,'hex') AS a_hex,
S.id AS s_id, S.timestamp AS s_timestamp, S.summary AS s_summary
FROM ati A
JOIN summaries S ON A.summary = S.id
WHERE (A.account = '\x0139fc4ea5015885d50c7730852b4a9b2249aaf54f0abb8a8ec44b78776668')
ORDER BY S.timestamp DESC LIMIT 10;
Again I will ask if you can confirm that the account address 3PHLj6j6YyqHVF3hXjqg5zeKHzZVQgCuaAZSaGo4TN5EXpaFUJ becomes the hex string 0139fc4ea5015885d50c7730852b4a9b2249aaf54f0abb8a8ec44b78776668 if you try to do you Python thing to it?
I would be silly spending a lot of time trying to find a value that isn’t there because it is incorrect.