Syntax for using json_each in subquery
Hmm, I think I found something that works, although I'm not sure if it's the best way to do it:

```python
tve = peewee.fn.json_each('[1,2,3]').alias('tve')
inactive_users = peewee.Select(from_list=[tve], columns=[tve.c.value]).cte('inactive_users')
dq = (Tweet
      .delete()
      .where(Tweet.user_id << inactive_users)
      .with_cte(inactive_users))
dq.execute()

``` I guess the proper way to do this would be to have `json_each` registered as a TableFunction, but right now we only get to use it through `JSONField.children()`, unless I'm missing something. Whoa, whoa... Slow down!

```python

id_list = [1, 2, 3]
id_json = json.dumps(id_list)

subq = Select(from_list=fn.json_each(id_json), columns=[Entity('value')])
query = Tweet.delete().where(Tweet.id.in_(subq))
```

This works fine for me. I think the crux of the problem is that your "column" is being treated as a sql parameter rather than a column name. Hence I use `columns=[Entity('value')]` to indicate this is a name. Thanks - that'll work! I couldn't figure out how to get it to recognize 'value' as a column name without binding it to something. @coleifer - For the record, when I try this as shown in your example on a Select query I get the following error:
`TypeError: object of type 'Function' has no len()`

I think it should be:
```python
subq = Select(from_list=[fn.json_each(id_json)], columns=[Entity('value')])
```
 Oh right, yep.
I'm trying to do something like this:

```sql
DELETE FROM tweet WHERE tweet.user_id IN (SELECT value FROM json_each('[1,2,3]'))
```

I have tried something like this, but it ends up selecting the literal string 'value' instead of the value column:

```python
inactive_users = peewee.Select(from_list=[peewee.fn.json_each('[1,2,3]')], columns=['value'])
dq = (Tweet
      .delete()
      .where(Tweet.user.in_(inactive_users)))
dq.execute()
```

In reality the JSON list is actually sourced from another query that's using the `json_group_array` aggregation to output a lengthy list of IDs that I am doing some post-processing on. If I simply pass the Python list in directly, it binds a host parameter for each list entry, which ends up overrunning the sqlite SQLITE_MAX_VARIABLE_NUMBER limit if the list is large; I'm trying to work around this by serializing the list back to a JSON string and then using the table-valued `json_each` function in a subquery to split it back out.