我试图查看两个表对象是否匹配,并找到了关于Python的__eq__
函数的文档,但不确定如何在代码中使用它。下面是我正在测试的代码:
def get_table(self, table_name, select_stmt=None):
"""
This method gets a table from the data connection using SQLAlchemy's reflection capability. Columns in the
select_stmt are included, with all other table columns excluded.
:param table_name: The name of the table being reflected.
:type table_name: str
:param select_stmt: The fields being included in the query. Default None.
:type select_stmt: str
:returns: SQLAlchemy Table object
"""
table = Table(table_name, self.meta)
self.log.debug("Reflecting table %s" % table_name)
if select_stmt == "all_columns":
select_stmt = None
self.insp.reflecttable(table, select_stmt)
return table
我的测试目前看起来像:
^{pr2}$
我终于发现了怎么做。问题是结果也返回了不匹配的对象值。通过将测试更改为
我得到了需要验证的表结构。在
相关问题 更多 >
编程相关推荐