mirror of
https://github.com/apache/superset.git
synced 2026-05-07 00:44:26 +00:00
Fix mapping
This commit is contained in:
@@ -305,6 +305,7 @@ class SnowflakeSemanticView(SemanticViewImplementation):
|
||||
"""
|
||||
Execute a query and return the results as a Pandas DataFrame.
|
||||
"""
|
||||
print("AM HERE")
|
||||
if not metrics and not dimensions:
|
||||
return DataFrame()
|
||||
|
||||
@@ -321,6 +322,17 @@ class SnowflakeSemanticView(SemanticViewImplementation):
|
||||
with connect(**connection_parameters) as connection:
|
||||
df = connection.cursor().execute(query, parameters).fetch_pandas_all()
|
||||
|
||||
# map column names to dimension/metric names instead of IDs
|
||||
mapping = {
|
||||
**{dimension.id: dimension.name for dimension in dimensions},
|
||||
**{metric.id: metric.name for metric in metrics},
|
||||
}
|
||||
print("BETO")
|
||||
print(df.columns)
|
||||
print(mapping)
|
||||
df.rename(columns=mapping, inplace=True)
|
||||
print(df.columns)
|
||||
|
||||
return SemanticResult(
|
||||
requests=[
|
||||
SemanticRequest(
|
||||
|
||||
Reference in New Issue
Block a user