chop-dbhi / dataexpress

[NOT MAINTAINED] DataExpress is a simple, Scala-based cross database ETL toolkit supporting Postgres, MySql, Oracle, SQLServer, and Sqlite
http://dataexpress.research.chop.edu
BSD 2-Clause "Simplified" License
72 stars 9 forks source link

Copy statement fails silently if no create target is specified #42

Open bruth opened 11 years ago

bruth commented 11 years ago

I had this:

copy query clarity.queries.patients from "clarity" to "target"

and needed this:

copy query clarity.queries.patients from "clarity" to "target" create "patients"
mitalia commented 10 years ago

This is because of the way the DSL is implemented. This is actually a very difficult thing to fix because what happens here is that

copy query clarity.queries.patients from "clarity" to "target"

creates an instance of ToFromTable. This class has methods like append or create, however using this approach, there is no way to ensure that one of those methods gets called. It might be necessary to have these somehow be part of the ToFromTable constructor as a function argument. You could then check to see if it is set at object creation time and if not, throw an error.