Yep, I'm aware of this workaround; however I'm trying to test the new pandas sqlalchemy bindings and they fail due to the problem above so it's out my control...
Is there a way to fix this in SA? I'll take a look at the queries in debug mode. On Tuesday, 2 September 2014 15:55:03 UTC+1, Michael Bayer wrote: > > it means that the query we do to reflect the columns in the table isn’t > coming up with this one. > > > A possible workaround now is to just add this column explicitly: > > t = Table(‘mytable’, m, Column(‘m_row$$’, integer), autoload=True) > > > > On Sep 2, 2014, at 10:26 AM, Ivan Smirnov <[email protected] > <javascript:>> wrote: > > So, if I understand correctly, in this example m_row$$ is a hidden column > automatically generated when a materialized view is created with rowid. > It's still accessible though, i.e. you can still select from it explicitly. > > On Monday, 1 September 2014 18:46:39 UTC+1, Ivan Smirnov wrote: >> >> py27/lib/python2.7/site-packages/sqlalchemy/engine/reflection.pyc in >> reflecttable(self, table, include_columns, exclude_columns) >> 591 cols_by_orig_name[c] if c in cols_by_orig_name >> 592 else table.c[c] >> --> 593 for c in columns >> 594 ], >> 595 **dict(unique=unique)) >> >> py27/lib/python2.7/site-packages/sqlalchemy/util/_collections.pyc in >> __getitem__(self, key) >> 155 >> 156 def __getitem__(self, key): >> --> 157 return self._data[key] >> 158 >> 159 def __delitem__(self, key): >> >> KeyError: u'm_row$$' >> > >> py27/lib/python2.7/site-packages/sqlalchemy/util/_collections.py(157)__getitem__() >> 156 def __getitem__(self, key): >> --> 157 return self._data[key] >> 158 >> >> >> If you have an index containing a column with a non-numeric character >> (like 'm_row$$'), reflection would fail as in the example above, since >> table.c would not contain it. >> >> Is there any way around it? >> >> P.S. It seems to be related to this thread from 4 years ago (MS SQL): >> >> https://groups.google.com/forum/#!searchin/sqlalchemy/keyerror/sqlalchemy/BcANLqW1D04/sRPMYpDLO8oJ >> > > -- > 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] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. > > > -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
