def read(self, *fields, **conditionals):
"""
Pull raw data into a dataframe. If no conditions are passed, pull the whole table.
Otherwise, filter based on the conditions specified ( currently only equality ).
"""
# Parse the list of fields to return
field_query = self._parse_fields(*fields)
# Parse the conditions
conditionals_query = self._parse_conditionals(**conditionals)
query = "SELECT {} FROM {} {}".format(field_query, self.table, conditionals_query)
if "DISTINCT" not in query:
query += " ORDER BY {}".format(self.timestamp_field)
return pd.read_sql(query, self.db)
评论列表
文章目录