Skip to content

Commit

Permalink
[sql lab] fix csv export where in query
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed May 3, 2017
1 parent 59a6f44 commit fc746aa
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions superset/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,16 +575,19 @@ def get_quoter(self):
def get_df(self, sql, schema):
sql = sql.strip().strip(';')
eng = self.get_sqla_engine(schema=schema)
cur = eng.execute(sql, schema=schema)
cols = [col[0] for col in cur.cursor.description]

conn = eng.raw_connection()
cur = conn.cursor()
cur.execute(sql, **self.db_engine_spec.cursor_execute_kwargs)

cols = [col[0] for col in cur.description]
df = pd.DataFrame(cur.fetchall(), columns=cols)

def needs_conversion(df_series):
if df_series.empty:
return False
for df_type in [list, dict]:
if isinstance(df_series[0], df_type):
return True
if isinstance(df_series[0], (list, dict)):
return True
return False

for k, v in df.dtypes.iteritems():
Expand Down

0 comments on commit fc746aa

Please sign in to comment.