Copy tables from one database to another with streams and queries