我的引擎有一个属性dMeta
,返回引擎元,然后我有一个类,其中有一个名为table
的方法基本上这样做:
def table(meta):
return Table('table1',meta,autoload=True,schema=genShema())
我自动加载表格:
t = SomeClass.table(engine.dMeta)
sql = select([t.c.ID, t.c.OPIS, t.c.IDG,
func.left(t.c.ID,2).label("Ident"),
(func.left(t.c.ID,2).label('Ident2')+' '+t.c.OPIS).label("show_as")])\
.where(t.c.ATRIBUT=="VPFA")
SQLAlchemy给出了错误:
def __getattr__(self, key):
try:
return self._data[key]
except KeyError:
raise AttributeError(key)
关键是ID
,self._data contains
' ID' = {Column}这是一个table1.ID
如果我把self._data[key]
我得到正确的值,没有错误,那么这里有什么问题?
即使我重新运行代码几次,有时它会中断,有时它不会:/
答案 0 :(得分:0)
看起来你没有正确地进行结论并且错误地尝试了这一点。
PACKAGE TStream & operator <<(TStream &Stream, String s)
{
UTF8String utf = s;
int Count = utf.Length();
Stream << Count;
Stream.WriteBuffer(utf.c_str(), Count);
return Stream;
}
PACKAGE TStream & operator >>(TStream &Stream, String &s)
{
UTF8String utf;
int Count;
Stream >> Count;
s.SetLength(Count);
Stream.ReadBuffer(utf.c_str(), Count);
s = utf;
return Stream;
}
PACKAGE TStream & operator <<(TStream &Stream, TStrings &pList)
{
int Count = pList.Count;
Stream << Count;
for (int i = 0; i < Count; ++i)
Stream << pList.Strings[i];
return Stream;
}
PACKAGE TStream & operator >>(TStream &Stream, TStrings &pList)
{
pList.BeginUpdate();
try
{
pList.Clear();
String s;
int Count;
Stream >> Count;
while (Count--)
{
Stream >> s;
pList.Add(s);
}
}
__finally {
pList.EndUpdate();
}
return Stream;
}