On Sun, Mar 11, 2018 at 8:25 AM, <[email protected]> wrote:
> Hello,
>
> I ran into a warning (1300, "Invalid utf8mb4 character string: 'C3D545'")
> when inserting or updating a `blob` and apparently that’s expected behavior
> as per MySQL bug 79317. However, according to one of the comments the
> solution would be to use the “_binary character-set introducer”.
>
> How would I specify that in SQLAlchemy for `blob` columns?
first off I have a feeling this could be avoided if you passed a
bytestring to the driver and not a unicode object, however I would
need complete details on python version, driver in use, an example
string, and the specific column type you are working with.
I've not seen an "introducer" before and not sure that is applicable
to a bound parameter passed by the driver. COLLATE is supported by
the method:
conn.execute(
table.insert().values(foobar=bindparam("value").collate("some_collation"),
{"value": "myvalue"}
)
but that's with Core, not ORM, and as usual, I really need to see
completely what you are doing. This is likely resolvable by just
passing a python bytestring and not a unicode object.
>
> Thanks!
> Jens
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
<div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 11,
2018 at 8:25 AM, <span dir="ltr"><<a
href="mailto:[email protected]"
target="_blank">[email protected]</a>></span>
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div
dir="ltr">Hello,<div><br></div><div>I ran into a warning (1300,
"Invalid utf8mb4 character string: 'C3D545'") when inserting or
updating a `blob` and apparently that’s expected behavior as per MySQL
<a href="https://bugs.mysql.com/bug.php?id=79317" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&q=https://bugs.mysql.com/bug.php?id%3D79317&source=gmail&ust=1520863558458000&usg=AFQjCNEFyG3rPp10tYDAMDaPTNeCsFGPjg">bug
79317</a>. However, according to one of the <a
href="https://bugs.mysql.com/bug.php?id=79317#c439353" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&q=https://bugs.mysql.com/bug.php?id%3D79317%23c439353&source=gmail&ust=1520863558458000&usg=AFQjCNE8i2v_JV4MFLTg6kuQNMA1OFF40w">comments</a>
the solution would be to use the “<a
href="https://dev.mysql.com/doc/refman/5.6/en/charset-literal.html"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&q=https://dev.mysql.com/doc/refman/5.6/en/charset-literal.html&source=gmail&ust=1520863558458000&usg=AFQjCNHI49-iJqVDJ1Q-M8Djiy72zcjOZQ"><b>_binary</b>
character-set introducer</a>”.</div><div><br></div><div>How would I
specify that in SQLAlchemy for `blob`
columns?</div><div><br></div><div>Thanks!</div><div>Jens</div></div>
<p></p>
-- <br>
SQLAlchemy - <br>
The Python SQL Toolkit and Object Relational Mapper<br>
<br>
<a href="http://www.sqlalchemy.org/" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&q=http://www.sqlalchemy.org/&source=gmail&ust=1520863558458000&usg=AFQjCNEVxXXps37tnptE3_m1n-CS9hs-HQ">http://www.sqlalchemy.org/</a><br>
<br>
To post example code, please provide an MCVE: Minimal, Complete, and
Verifiable Example. See <a href="http://stackoverflow.com/help/mcve"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&q=http://stackoverflow.com/help/mcve&source=gmail&ust=1520863558458000&usg=AFQjCNFBdtc_Eo6udl3mZUWB-DXd8jDHsQ">http://stackoverflow.com/help/<wbr>mcve</a>
for a full description.<br>
--- <br>
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.<br>
To unsubscribe from this group and stop receiving emails from it, send
an email to <a href="mailto:[email protected]"
target="_blank">sqlalchemy+unsubscribe@<wbr>googlegroups.com</a>.<br>
To post to this group, send email to <a
href="mailto:[email protected]"
target="_blank">[email protected]</a>.<br>
Visit this group at <a
href="https://groups.google.com/group/sqlalchemy" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&q=https://groups.google.com/group/sqlalchemy&source=gmail&ust=1520863558458000&usg=AFQjCNG_mqJZCAdO9FG8KCwkycjU7xAVnQ">https://groups.google.com/<wbr>group/sqlalchemy</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&q=https://groups.google.com/d/optout&source=gmail&ust=1520863558458000&usg=AFQjCNH2lLLyQwdw8-J6d1dXKprTSEMeow">https://groups.google.com/d/<wbr>optout</a>.<br>
</blockquote></div><br></div>
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.