mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +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.
|
Execute a query and return the results as a Pandas DataFrame.
|
||||||
"""
|
"""
|
||||||
|
print("AM HERE")
|
||||||
if not metrics and not dimensions:
|
if not metrics and not dimensions:
|
||||||
return DataFrame()
|
return DataFrame()
|
||||||
|
|
||||||
@@ -321,6 +322,17 @@ class SnowflakeSemanticView(SemanticViewImplementation):
|
|||||||
with connect(**connection_parameters) as connection:
|
with connect(**connection_parameters) as connection:
|
||||||
df = connection.cursor().execute(query, parameters).fetch_pandas_all()
|
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(
|
return SemanticResult(
|
||||||
requests=[
|
requests=[
|
||||||
SemanticRequest(
|
SemanticRequest(
|
||||||
|
|||||||
Reference in New Issue
Block a user