On Wed, Mar 14, 2018 at 3:09 PM, Colton Allen <[email protected]> wrote:
> Casting raised this error:
>
> sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) cannot cast
> type outcome_kind to trigger_event
>
> This is what it looks like in the select:
>
> cast(outcome.c.kind, trigger.c.on_event.type)
>
> Outcome kind and trigger event are identical besides their name.


shrugs, this is more of a Postgresql SQL issue.   Check on various PG
mailing lists and/or stack overflow to get a plain SQL statement that
works. I can make SQLAlchemy render it, whatever it is.



>
> On Wednesday, March 14, 2018 at 8:58:21 AM UTC-7, Mike Bayer wrote:
>>
>> On Wed, Mar 14, 2018 at 11:50 AM, Colton Allen <[email protected]> wrote:
>> > I'm trying to copy an enum of one type to an enum of another type.  The
>> > below is the query I'm using:
>> >
>> >     import sqlalchemy as sa
>> >
>> >     statement = sa.insert(table_a).from_select(['enum_a'],
>> > sa.select(table_b.c.enum_b))
>> >     connection.execute(statement)
>> >
>> > Which raises this error in Postgres:
>> >
>> > Error: (psycopg2.ProgrammingError) column "enum_a" is of type enum_a but
>> > expression is of type enum_b
>> >
>> > Is there a way to parse the enum to its string-value and just insert
>> > that?
>>
>> did you try casting?  select([cast(table_b.c.enum_b,
>> table_a.c.enum_a.type)])
>>
>>
>>
>> >
>> > --
>> > 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 Wed, Mar 14,
>> 2018 at 11:50 AM, Colton Allen <span dir="ltr">&lt;<a
>> href="mailto:[email protected]";
>> target="_blank">[email protected]</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">I'm
>> trying to copy an enum of one type to an enum of another type.&nbsp;
>> The below is the query I'm using:<br><br><div
>>
>> style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"
>> class="m_5346237645183833733prettyprint"><code
>> class="m_5346237645183833733prettyprint"><div
>> class="m_5346237645183833733subprettyprint"><span style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">&nbsp; &nbsp;
>> </span><span style="color:#008"
>> class="m_5346237645183833733styled-by-prettify">import</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify">
>> sqlalchemy </span><span style="color:#008"
>> class="m_5346237645183833733styled-by-prettify">as</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify">
>> sa<br><br>&nbsp; &nbsp; statement </span><span style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">=</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify">
>> sa</span><span style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">.</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">insert</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">(</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">table_a</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">).</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">from_select</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify"><wbr>([</span><span
>> style="color:#080"
>> class="m_5346237645183833733styled-by-prettify">'enum_a'</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">],</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify">
>> sa</span><span style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">.</span><span
>> style="color:#008"
>> class="m_5346237645183833733styled-by-prettify">select</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">(</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">table_b</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">.</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">c</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">.</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">enum_b</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">))</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify"><br>&nbsp; &nbsp;
>> connection</span><span style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">.</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">execute</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">(</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">statement</span><span
>> style="color:#660"
>>
>> class="m_5346237645183833733styled-by-prettify">)</span></div></code></div><br>Which
>> raises this error in Postgres:<br><br><div
>>
>> style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"
>> class="m_5346237645183833733prettyprint"><code
>> class="m_5346237645183833733prettyprint"><div
>> class="m_5346237645183833733subprettyprint"><span style="color:#606"
>> class="m_5346237645183833733styled-by-prettify">Error</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">:</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify">
>> </span><span style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">(</span><span
>> style="color:#000"
>> class="m_5346237645183833733styled-by-prettify">psycopg2</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">.</span><span
>> style="color:#606"
>>
>> class="m_5346237645183833733styled-by-prettify">ProgrammingError</span><span
>> style="color:#660"
>> class="m_5346237645183833733styled-by-prettify">)</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify">
>> column </span><span style="color:#080"
>> class="m_5346237645183833733styled-by-prettify">"enum_a"</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify">
>> </span><span style="color:#008"
>> class="m_5346237645183833733styled-by-prettify">is</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify"> of
>> type enum_a but expression </span><span style="color:#008"
>> class="m_5346237645183833733styled-by-prettify">is</span><span
>> style="color:#000" class="m_5346237645183833733styled-by-prettify"> of
>> type enum_b</span></div></code></div><br>Is there a way to parse the
>> enum to its string-value and just insert that?<br></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=1521129429269000&amp;usg=AFQjCNHmvgsT_kDCoTqpNxlDfBETa_ObHg";>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=1521129429270000&amp;usg=AFQjCNHGKzBS14DGg_cFrRN-n-IzpJfk1g";>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&amp;q=https://groups.google.com/group/sqlalchemy&amp;source=gmail&amp;ust=1521129429270000&amp;usg=AFQjCNEOgO9C-lc66rrcMzLixdGjRtIxcw";>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=1521129429270000&amp;usg=AFQjCNEOAw5y_nxPN5IevQQswx7IVim_0Q";>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.
<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 14,
2018 at 3:09 PM, Colton Allen <span dir="ltr">&lt;<a
href="mailto:[email protected]";
target="_blank">[email protected]</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">Casting raised this error:<br><br><div
style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"
class="m_-5473722441904371823prettyprint"><code
class="m_-5473722441904371823prettyprint"><div
class="m_-5473722441904371823subprettyprint"><span style="color:#000"
class="m_-5473722441904371823styled-by-prettify">sqlalchemy</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">.</span><span
style="color:#000"
class="m_-5473722441904371823styled-by-prettify">exc</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">.</span><span
style="color:#606"
class="m_-5473722441904371823styled-by-prettify">ProgrammingErro<wbr>r</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">:</span><span
style="color:#000" class="m_-5473722441904371823styled-by-prettify">
</span><span style="color:#660"
class="m_-5473722441904371823styled-by-prettify">(</span><span
style="color:#000"
class="m_-5473722441904371823styled-by-prettify">psycopg2</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">.</span><span
style="color:#606"
class="m_-5473722441904371823styled-by-prettify">ProgrammingError</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">)</span><span
style="color:#000" class="m_-5473722441904371823styled-by-prettify">
cannot cast type outcome_kind to
trigger_event<br></span></div></code></div><br>This is what it looks
like in the select:<br><br><div
style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"
class="m_-5473722441904371823prettyprint"><code
class="m_-5473722441904371823prettyprint"><div
class="m_-5473722441904371823subprettyprint"><span style="color:#000"
class="m_-5473722441904371823styled-by-prettify">cast</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">(</span><span
style="color:#000"
class="m_-5473722441904371823styled-by-prettify">outcome</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">.</span><span
style="color:#000"
class="m_-5473722441904371823styled-by-prettify">c</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">.</span><span
style="color:#000"
class="m_-5473722441904371823styled-by-prettify">kind</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">,</span><span
style="color:#000" class="m_-5473722441904371823styled-by-prettify">
trigger</span><span style="color:#660"
class="m_-5473722441904371823styled-by-prettify">.</span><span
style="color:#000"
class="m_-5473722441904371823styled-by-prettify">c</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">.</span><span
style="color:#000"
class="m_-5473722441904371823styled-by-prettify">on_event</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">.</span><span
style="color:#000"
class="m_-5473722441904371823styled-by-prettify">type</span><span
style="color:#660"
class="m_-5473722441904371823styled-by-prettify">)</span></div></code></div><br>Outcome
kind and trigger event are identical besides their name.<br><br>On
Wednesday, March 14, 2018 at 8:58:21 AM UTC-7, Mike Bayer
wrote:<blockquote class="gmail_quote"
style="margin:0;margin-left:0.8ex;border-left:1px #ccc
solid;padding-left:1ex"><span class="">On Wed, Mar 14, 2018 at 11:50
AM, Colton Allen &lt;<a rel="nofollow">[email protected]</a>&gt;
wrote:
<br>&gt; I'm trying to copy an enum of one type to an enum of another
type. &nbsp;The
<br>&gt; below is the query I'm using:
<br>&gt;
<br>&gt; &nbsp; &nbsp; import sqlalchemy as sa
<br>&gt;
<br>&gt; &nbsp; &nbsp; statement =
sa.insert(table_a).from_select<wbr>(['enum_a'],
<br>&gt; sa.select(table_b.c.enum_b))
<br>&gt; &nbsp; &nbsp; connection.execute(statement)
<br>&gt;
<br>&gt; Which raises this error in Postgres:
<br>&gt;
<br>&gt; Error: (psycopg2.ProgrammingError) column "enum_a" is of type
enum_a but
<br>&gt; expression is of type enum_b
<br>&gt;
<br>&gt; Is there a way to parse the enum to its string-value and just
insert that?
<br>
<br>did you try casting? &nbsp;select([cast(table_b.c.enum_b<wbr>,
table_a.c.enum_a.type)])
<br>
<br>
<br>
<br>&gt;
<br>&gt; --
<br>&gt; SQLAlchemy -
<br>&gt; The Python SQL Toolkit and Object Relational Mapper
<br>&gt;
<br>&gt; <a href="http://www.sqlalchemy.org/"; rel="nofollow"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=http://www.sqlalchemy.org/&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFxyjDM0j1_q7bnAea-peXucxC8Bg";>http://www.sqlalchemy.org/</a>
<br>&gt;
<br>&gt; To post example code, please provide an MCVE: Minimal, Complete, and
<br>&gt; Verifiable Example. See <a
href="http://stackoverflow.com/help/mcve"; rel="nofollow"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=http://stackoverflow.com/help/mcve&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNGOEbupWlUKcU3s36Q9Bj4S5sfncA";>http://stackoverflow.com/help/<wbr>mcve</a>
for a full
<br>&gt; description.
<br>&gt; ---
<br>&gt; You received this message because you are subscribed to the
Google Groups
<br>&gt; "sqlalchemy" group.
<br>&gt; To unsubscribe from this group and stop receiving emails from
it, send an
<br></span>&gt; email to <a
rel="nofollow">sqlalchemy+...@googlegroups.<wbr>com</a>.
<br>&gt; To post to this group, send email to <a
rel="nofollow">[email protected]</a>.
<br><span class="">&gt; Visit this group at <a
href="https://groups.google.com/group/sqlalchemy"; rel="nofollow"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://groups.google.com/group/sqlalchemy&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNH3fWjfS6qJ4rOqpi8eAPu7iwhxTw";>https://groups.google.com/grou<wbr>p/sqlalchemy</a>.
<br>&gt; For more options, visit <a
href="https://groups.google.com/d/optout"; rel="nofollow"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://groups.google.com/d/optout&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFExWjr-z6TDHXnBCKruMclmWibFA";>https://groups.google.com/d/op<wbr>tout</a>.
<br>&lt;div class="gmail_extra"&gt;&lt;br&gt;&lt;div
class="gmail_quote"&gt;On Wed, Mar 14,
<br>2018 at 11:50 AM, Colton Allen &lt;span dir="ltr"&gt;&amp;lt;&lt;a
<br></span>href="mailto:<a rel="nofollow">cmana...@gmail.<wbr>com</a>"
<br>target="_blank"&gt;<a
rel="nofollow">cmana...@gmail<wbr>.com</a>&lt;/a&gt;&amp;gt;&lt;/span&gt;
<br><div><div class="h5">wrote:&lt;br&gt;&lt;blockquote
class="gmail_quote" style="margin:0 0 0
<br>.8ex;border-left:1px #ccc solid;padding-left:1ex"&gt;&lt;div
dir="ltr"&gt;I'm
<br>trying to copy an enum of one type to an enum of another type.&amp;nbsp;
<br>The below is the query I'm using:&lt;br&gt;&lt;br&gt;&lt;div
<br>style="background-color:rgb(25<wbr>0,250,250);border-color:rgb(18<wbr>7,187,187);border-style:solid;<wbr>border-width:1px"
<br>class="m_5346237645183833733pr<wbr>ettyprint"&gt;&lt;code
<br>class="m_5346237645183833733pr<wbr>ettyprint"&gt;&lt;div
<br>class="m_5346237645183833733su<wbr>bprettyprint"&gt;&lt;span
style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;&amp;nbsp;
&amp;nbsp;
<br>&lt;/span&gt;&lt;span style="color:#008"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;import&lt;/<wbr>span&gt;&lt;span
<br>style="color:#000" class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;
<br>sqlalchemy &lt;/span&gt;&lt;span style="color:#008"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;as&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000" class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;
<br>sa&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; statement
&lt;/span&gt;&lt;span style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;=&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000" class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;
<br>sa&lt;/span&gt;&lt;span style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;.&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;insert&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;(&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;table_a&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;).&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;from_select&lt;<wbr>/span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;&lt;wbr&gt;([&lt;/<wbr>span&gt;&lt;span
<br>style="color:#080"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;'enum_a'&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;],&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000" class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;
<br>sa&lt;/span&gt;&lt;span style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;.&lt;/span&gt;&lt;<wbr>span
<br>style="color:#008"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;select&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;(&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;table_b&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;.&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;c&lt;/span&gt;&lt;<wbr>span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;.&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;enum_b&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;))&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;&lt;br&gt;&amp;nbsp;
&amp;nbsp;
<br>connection&lt;/span&gt;&lt;span style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;.&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;execute&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;(&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;statement&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;)&lt;/span&gt;&lt;/<wbr>div&gt;&lt;/code&gt;&lt;/div&gt;&lt;br&gt;Which
<br>raises this error in Postgres:&lt;br&gt;&lt;br&gt;&lt;div
<br>style="background-color:rgb(25<wbr>0,250,250);border-color:rgb(18<wbr>7,187,187);border-style:solid;<wbr>border-width:1px"
<br>class="m_5346237645183833733pr<wbr>ettyprint"&gt;&lt;code
<br>class="m_5346237645183833733pr<wbr>ettyprint"&gt;&lt;div
<br>class="m_5346237645183833733su<wbr>bprettyprint"&gt;&lt;span
style="color:#606"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;Error&lt;/span&gt;<wbr>&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;:&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000" class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;
<br>&lt;/span&gt;&lt;span style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;(&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;psycopg2&lt;/<wbr>span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;.&lt;/span&gt;&lt;<wbr>span
<br>style="color:#606"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;<wbr>ProgrammingError&lt;/span&gt;&lt;span
<br>style="color:#660"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;)&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000" class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;
<br>column &lt;/span&gt;&lt;span style="color:#080"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;"enum_a"&lt;/<wbr>span&gt;&lt;span
<br>style="color:#000" class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;
<br>&lt;/span&gt;&lt;span style="color:#008"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;is&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
class="m_5346237645183833733st<wbr>yled-by-prettify"&gt; of
<br>type enum_a but expression &lt;/span&gt;&lt;span style="color:#008"
<br>class="m_5346237645183833733st<wbr>yled-by-prettify"&gt;is&lt;/span&gt;&lt;<wbr>span
<br>style="color:#000"
class="m_5346237645183833733st<wbr>yled-by-prettify"&gt; of
<br>type 
enum_b&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;/di<wbr>v&gt;&lt;br&gt;Is
there a way to parse the
<br>enum to its string-value and just insert that?&lt;br&gt;&lt;/div&gt;
<br>
<br>&lt;p&gt;&lt;/p&gt;
<br>
<br>-- &lt;br&gt;
<br>SQLAlchemy - &lt;br&gt;
<br>The Python SQL Toolkit and Object Relational Mapper&lt;br&gt;
<br>&amp;nbsp;&lt;br&gt;
<br>&lt;a href="<a href="http://www.sqlalchemy.org/"; rel="nofollow"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=http://www.sqlalchemy.org/&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFxyjDM0j1_q7bnAea-peXucxC8Bg";>http://www.sqlalchemy.or<wbr>g/</a>"
target="_blank"
<br>data-saferedirecturl="<a
href="https://www.google.com/url?hl=en&amp;amp;q=http://www.sqlalchemy.org/&amp;amp;source=gmail&amp;amp;ust=1521129429269000&amp;amp;usg=AFQjCNHmvgsT_kDCoTqpNxlDfBETa_ObHg";
rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://www.google.com/url?hl%3Den%26amp;q%3Dhttp://www.sqlalchemy.org/%26amp;source%3Dgmail%26amp;ust%3D1521129429269000%26amp;usg%3DAFQjCNHmvgsT_kDCoTqpNxlDfBETa_ObHg&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFB073ie3mZfxNuLka6qVxYJrrozA";>https://<wbr>www.google.com/url?hl=en&amp;amp;q<wbr>=http://www.sqlalchemy.org/&amp;am<wbr>p;source=gmail&amp;amp;ust=1521129<wbr>429269000&amp;amp;usg=AFQjCNHmvgsT<wbr>_kDCoTqpNxlDfBETa_ObHg</a>"&gt;<a
href="http://www.sqlalchemy.org/"; rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=http://www.sqlalchemy.org/&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFxyjDM0j1_q7bnAea-peXucxC8Bg";>http:/<wbr>/www.sqlalchemy.org/</a>&lt;/a&gt;&lt;br&gt;
<br>&amp;nbsp;&lt;br&gt;
<br>To post example code, please provide an MCVE: Minimal, Complete, and
<br>Verifiable Example. &nbsp;See &nbsp;&lt;a href="<a
href="http://stackoverflow.com/help/mcve"; rel="nofollow"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=http://stackoverflow.com/help/mcve&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNGOEbupWlUKcU3s36Q9Bj4S5sfncA";>http://stackoverflow.com<wbr>/help/mcve</a>"
<br>target="_blank"
<br>data-saferedirecturl="<a
href="https://www.google.com/url?hl=en&amp;amp;q=http://stackoverflow.com/help/mcve&amp;amp;source=gmail&amp;amp;ust=1521129429270000&amp;amp;usg=AFQjCNHGKzBS14DGg_cFrRN-n-IzpJfk1g";
rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://www.google.com/url?hl%3Den%26amp;q%3Dhttp://stackoverflow.com/help/mcve%26amp;source%3Dgmail%26amp;ust%3D1521129429270000%26amp;usg%3DAFQjCNHGKzBS14DGg_cFrRN-n-IzpJfk1g&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNHRUIE2D7_j8Rjnkuh2OgdjlTZu1g";>https://<wbr>www.google.com/url?hl=en&amp;amp;q<wbr>=http://stackoverflow.com/help<wbr>/mcve&amp;amp;source=gmail&amp;amp;<wbr>ust=1521129429270000&amp;amp;usg=<wbr>AFQjCNHGKzBS14DGg_cFrRN-n-IzpJ<wbr>fk1g</a>"&gt;<a
href="http://stackoverflow.com/help/"; rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=http://stackoverflow.com/help/&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFbR5xouw25Tmvwt0KsAgSXAVKK9g";>http://stackoverflow.<wbr>com/help/</a>&lt;wbr&gt;mcve&lt;/a&gt;
<br>for a full description.&lt;br&gt;
<br>--- &lt;br&gt;
<br>You received this message because you are subscribed to the Google
<br>Groups "sqlalchemy" group.&lt;br&gt;
<br>To unsubscribe from this group and stop receiving emails from it, send
<br>an email to &lt;a href="mailto:<a
rel="nofollow">sqlalchemy+unsubs<wbr>[email protected]</a>"
<br>target="_blank"&gt;sqlalchemy+uns<wbr>ubscribe@&lt;wbr&gt;<a
href="http://googlegroups.com"; rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=http://googlegroups.com&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNGCPEyJ55RIMusPvBzmzh_GJkEgRQ";>googlegroups.com</a><wbr>&lt;/a&gt;.&lt;br&gt;
<br>To post to this group, send email to &lt;a
<br></div></div>href="mailto:<a
rel="nofollow">sqlal...@googlegr<wbr>oups.com</a>"
<br>target="_blank"&gt;<a
rel="nofollow">sqlal...@googl<wbr>egroups.com</a>&lt;/a&gt;.&lt;br&gt;
<br><span class="">Visit this group at &lt;a
<br>href="<a href="https://groups.google.com/group/sqlalchemy";
rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://groups.google.com/group/sqlalchemy&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNH3fWjfS6qJ4rOqpi8eAPu7iwhxTw";>https://groups.google.co<wbr>m/group/sqlalchemy</a>"
target="_blank"
<br>data-saferedirecturl="<a
href="https://www.google.com/url?hl=en&amp;amp;q=https://groups.google.com/group/sqlalchemy&amp;amp;source=gmail&amp;amp;ust=1521129429270000&amp;amp;usg=AFQjCNEOgO9C-lc66rrcMzLixdGjRtIxcw";
rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://www.google.com/url?hl%3Den%26amp;q%3Dhttps://groups.google.com/group/sqlalchemy%26amp;source%3Dgmail%26amp;ust%3D1521129429270000%26amp;usg%3DAFQjCNEOgO9C-lc66rrcMzLixdGjRtIxcw&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNGpkxf7C8kX_posz7Q0mwNW4ipZ-g";>https://<wbr>www.google.com/url?hl=en&amp;amp;q<wbr>=https://groups.google.com/gro<wbr>up/sqlalchemy&amp;amp;source=gmail<wbr>&amp;amp;ust=1521129429270000&amp;amp;<wbr>usg=AFQjCNEOgO9C-lc66rrcMzLixd<wbr>GjRtIxcw</a>"&gt;<a
href="https://groups.google.com/"; rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://groups.google.com/&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFepiqHsX0Q2rnP9ft-lp_zzaIBbA";>https://groups.<wbr>google.com/</a>&lt;wbr&gt;group/sqlalche<wbr>my&lt;/a&gt;.&lt;br&gt;
<br>For more options, visit &lt;a href="<a
href="https://groups.google.com/d/optout"; rel="nofollow"
target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://groups.google.com/d/optout&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFExWjr-z6TDHXnBCKruMclmWibFA";>https://groups.google.co<wbr>m/d/optout</a>"
<br>target="_blank"
<br>data-saferedirecturl="<a
href="https://www.google.com/url?hl=en&amp;amp;q=https://groups.google.com/d/optout&amp;amp;source=gmail&amp;amp;ust=1521129429270000&amp;amp;usg=AFQjCNEOAw5y_nxPN5IevQQswx7IVim_0Q";
rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://www.google.com/url?hl%3Den%26amp;q%3Dhttps://groups.google.com/d/optout%26amp;source%3Dgmail%26amp;ust%3D1521129429270000%26amp;usg%3DAFQjCNEOAw5y_nxPN5IevQQswx7IVim_0Q&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNFpSD0QnRLR_1SY64N6Mov0KIJqjw";>https://<wbr>www.google.com/url?hl=en&amp;amp;q<wbr>=https://groups.google.com/d/o<wbr>ptout&amp;amp;source=gmail&amp;amp;ust<wbr>=1521129429270000&amp;amp;usg=AFQj<wbr>CNEOAw5y_nxPN5IevQQswx7IVim_0Q</a><wbr>"&gt;<a
href="https://groups.google.com/d/"; rel="nofollow" target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=en&amp;q=https://groups.google.com/d/&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNGVvLg7fqBbdC3NxfnX-lZ34fO9Hg";>https://groups.google.com/d/</a><wbr>&lt;wbr&gt;optout&lt;/a&gt;.&lt;br&gt;
<br>&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
<br></span></blockquote></div><div class="HOEnZb"><div class="h5">

<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=1521142081622000&amp;usg=AFQjCNFxyjDM0j1_q7bnAea-peXucxC8Bg";>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=1521142081622000&amp;usg=AFQjCNGOEbupWlUKcU3s36Q9Bj4S5sfncA";>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&amp;q=https://groups.google.com/group/sqlalchemy&amp;source=gmail&amp;ust=1521142081622000&amp;usg=AFQjCNH3fWjfS6qJ4rOqpi8eAPu7iwhxTw";>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=1521142081622000&amp;usg=AFQjCNFExWjr-z6TDHXnBCKruMclmWibFA";>https://groups.google.com/d/<wbr>optout</a>.<br>
</div></div></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.

Reply via email to