On Sun, Mar 11, 2018 at 8:25 AM,  <jens.troe...@gmail.com> 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 sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> 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">&lt;<a
href="mailto:jens.troe...@gmail.com";
target="_blank">jens.troe...@gmail.com</a>&gt;</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&nbsp;(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&amp;q=https://bugs.mysql.com/bug.php?id%3D79317&amp;source=gmail&amp;ust=1520863558458000&amp;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&amp;q=https://bugs.mysql.com/bug.php?id%3D79317%23c439353&amp;source=gmail&amp;ust=1520863558458000&amp;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&amp;q=https://dev.mysql.com/doc/refman/5.6/en/charset-literal.html&amp;source=gmail&amp;ust=1520863558458000&amp;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>
&nbsp;<br>
<a href="http://www.sqlalchemy.org/"; target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=http://www.sqlalchemy.org/&amp;source=gmail&amp;ust=1520863558458000&amp;usg=AFQjCNEVxXXps37tnptE3_m1n-CS9hs-HQ";>http://www.sqlalchemy.org/</a><br>
&nbsp;<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&amp;q=http://stackoverflow.com/help/mcve&amp;source=gmail&amp;ust=1520863558458000&amp;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:sqlalchemy+unsubscr...@googlegroups.com";
target="_blank">sqlalchemy+unsubscribe@<wbr>googlegroups.com</a>.<br>
To post to this group, send email to <a
href="mailto:sqlalchemy@googlegroups.com";
target="_blank">sqlalchemy@googlegroups.com</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&amp;q=https://groups.google.com/group/sqlalchemy&amp;source=gmail&amp;ust=1520863558458000&amp;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&amp;q=https://groups.google.com/d/optout&amp;source=gmail&amp;ust=1520863558458000&amp;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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to