Copy uses copy.deepcopy
Allow customsql in relations
Escape part of AS as reference