If we had `def execute(cursor, query, **kwargs):` here then the method would 
have to be like this:

```python
def execute(cursor, query, **kwargs):
    kwargs['async'] = kwargs.pop('async_', False)
    cursor.execute(query, **kwargs) 
```

Since SQL Lab is passing `async_=True`, but PyHive expects an `async` named 
argument. We're basically mapping the keyword argument from `async_` to 
`async`, as it's passed from SQL Lab to PyHive.

I prefer having it explicitly named in the function signature instead:

```python
def execute(cursor, query, async_=False, **kwargs):
    kwargs = {'async': async_}
    cursor.execute(query, **kwargs)
```

This way if you're looking at this line in `sql_lab.py`:

https://github.com/apache/incubator-superset/blob/be04c98cd3a55aec9c9dd6d1457de5655ad20b30/superset/sql_lab.py#L175

You can `grep` and find which function takes the `async` (`async_`) argument.

[ Full content available at: 
https://github.com/apache/incubator-superset/pull/5759 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to