giftig commented on PR #25950:
URL: https://github.com/apache/superset/pull/25950#issuecomment-1809882165

   @john-bodley I tried passing the rest of the context alongside these 
parameters but we're actually using this data to add to a `query_obj` which we 
use to call this method:
   
   ```python
       def get_sqla_query(  # pylint: 
disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements
           self,
           apply_fetch_values_predicate: bool = False,
           columns: Optional[list[Column]] = None,
           extras: Optional[dict[str, Any]] = None,
           filter: Optional[  # pylint: disable=redefined-builtin
               list[utils.QueryObjectFilterClause]
           ] = None,
           from_dttm: Optional[datetime] = None,
           granularity: Optional[str] = None,
           groupby: Optional[list[Column]] = None,
           inner_from_dttm: Optional[datetime] = None,
           inner_to_dttm: Optional[datetime] = None,
           is_rowcount: bool = False,
           is_timeseries: bool = True,
           metrics: Optional[list[Metric]] = None,
           orderby: Optional[list[OrderBy]] = None,
           order_desc: bool = True,
           to_dttm: Optional[datetime] = None,
           series_columns: Optional[list[Column]] = None,
           series_limit: Optional[int] = None,
           series_limit_metric: Optional[Metric] = None,
           row_limit: Optional[int] = None,
           row_offset: Optional[int] = None,
           timeseries_limit: Optional[int] = None,
           timeseries_limit_metric: Optional[Metric] = None,
           time_shift: Optional[str] = None,
   ```
   so we can't pass everything; in my case it contained `time_column`, for 
example, which isn't a valid argument to this method. I guess what we really 
need to do is intelligently pass all arguments of this method through which we 
might have in the context, and that might also involve fixing some types as it 
did in my case. I captured some context from my chart, and saw:
   
   ```python
   {'columns': ['ds', 'gender', 'name', 'num_boys', 'num_girls', 'from_dttm'],
    'filter': [{'col': 'ds',
                'op': 'TEMPORAL_RANGE',
                'val': 'DATEADD(DATETIME("now"), -30, year) : now'}],
    'from_dttm': '1993-11-14T09:16:20',
    'groupby': None,
    'metrics': None,
    'row_limit': 1000,
    'row_offset': 0,
    'table_columns': ['ds',
                      'gender',
                      'name',
                      'num_boys',
                      'num_girls',
                      'from_dttm'],
    'time_column': None,
    'time_grain': 'P1D',
    'to_dttm': '2023-11-14T09:16:20'}
   ```
   So at a glance I see basic properties of the dataset are present, e.g. 
`columns`, `filter`, `groupby`, but are in a serialised form so we'd need to 
recover these somehow. I don't want to creep beyond my original scope too much 
here, as I don't have good test cases for expected behaviour if I try to pass 
in some of these fields and this is a huge method, several hundred lines long, 
so I'd suggest we raise this as a possible future improvement.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to