On 9/17/07, Thibaut Barrère <[EMAIL PROTECTED]> wrote: > Great - keep me posted! > > Raw ideas again, but what I've been doing at some point in my tests > was traversing ObjectSpace to get all the subclasses of > ActiveWarehouse::Fact or Dimension, and assign them table_name = > "tmp_" + table_name (unless the table_name already begins with "tmp_", > which can happen if you include a "common.rb" in each of your control > files then call this method to ensure every AR in scope is properly > "temporised"). > > Basically I think that unless specified otherwise, when > use_temp_tables is called with true, we could handle the AR patching > behind. > > If you find this (or something similar) interesting and not too much > black-magic, I could work on a patch (I will do it for myself anyway > when you'll have fixed the temp table functionality).
So this would allow you to easily use the AR objects...yes, I'd like to see this happen, and I think it could be mixed into AR::Base at runtime if temp tables are being used, something overriding table_name perhaps? On a related note I've actually found a better way to create the temp table with MySQL, using two statements. It'll require an update to adapter extensions, but I think it's the right way to go. > Still on this topic, here's a use case which I'd like to improve: > > use_temp_tables > # use a variable for further reference > table = "date_dimension" > ... > destination :table => table # (handles temp table mapping alone as I > seem to remember) > > # this won't work because the table is not translated to the temp table > screen(:fatal) do > connection.query("select distinct customer_type from #{table}") > end > > Basically, I think we'd just need a small helper which would do : > def table_name(table_name) > use_temp_tables? ? "tmp_#{table_name}" : table_name > end > > (that's the idea, not the implementation) > > to allow a more seamless use in the screen. Yes, I think that would be a good helper, although if possible have it get the table name from ETL::Engine.table_name. > Now all this is just polishing - but I think it brings value. Agreed. V/r Anthony -- Cell: 321 473-4966 Current Location: Melbourne, FL _______________________________________________ Activewarehouse-discuss mailing list Activewarehouse-discuss@rubyforge.org http://rubyforge.org/mailman/listinfo/activewarehouse-discuss