Support queries that span multiple tables

Selecting a model and connected tables would throw an 'Array to string
conversion' error and fail to process the download. Converting the array
keys into a dot notation (using array_dot) and then flattening the row,
again, using array_dot, allows such queries to work.