activewarehouse / activewarehouse-etl

Extract-Transform-Load library from ActiveWarehouse

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

does this replace rails-sql-views

barancw opened this issue · comments

Sorry to be a completed n00b here but is this supposed to replace the rails-sql-views gem? I see that the views gem was last updated in 2010. I want to use this functionality in my new app and I'm searching for the most up to date, rails 3.2.5 to do this. Thanks!

Hi! No worries on the newbiness :)

Nothing in activewarehouse-etl replaces rails-sql-views so far; it's just that the views gem hasn't been updated at all.

If you need views in your app, I suggest the following possibilities:

  • have a look at the various forks because I'm pretty sure someone will have updated it (if you do that work, please share, maybe I can re-release a version at some point)
  • have a look at the various custom versions
  • or find another gem to do that maybe

Hope this helps! Let me know what you will end up using.

Thanks for the quick response!

I looked through the various forks and custom gems. I didn't find anything that looked promising. I've put a question out to stackoverflow about this: http://stackoverflow.com/questions/11616309/is-there-an-updated-rails-sql-views-gem-for-rails-3-2

Based on the number of downloads of the original gem I'm going to give it a shot. I am leery because I've been burnt by old gems in the past. However, it doesn't seem that there is a good alternative at the moment.

There is reference to using view backed models in this book: http://books.google.com/books?id=thTju-4duY4C&lpg=PP1&ots=nFmsRSwKu0&dq=enterprise%20rails&pg=PA147#v=onepage&q&f=false. I have this book and I've read the chapter. They don't suggest this gem as one is not actually needed however there is no rails tracking of the creation of the view as this gem provides.

I'm under a deadline at the moment but I will look into updating this in the future. Thank you so much for your time and assistance.

You welcome! If you are on a deadline, I can only suggest that you do some timeboxed testing only.

I suspect the original gem is not working anymore as a good bunch of things have changed since then (Ruby 1.9, Rails 3+ etc), so be prudent!

If it doesn't work I would probably create the views manually myself from a migration, using "execute sql" statements.

Good luck!

After sitting down to work with this gem I can see that you are right. It's got a lot of legacy issues. I am trolling around and it looks like there might be enough forks to fix the major issues. I am wondering if the issues that this gem addressed have gone away.

It seems like the big issues are:

  • Without this you need to put SQL code directly in your migrations to have them tracked by rails
    • this is not a show stoper, just annoying
    • as far as I can google, I don't see that this is resolved automatically in Rails 3.2
  • ActiveRecord::SchemaDumper is not view aware
    • From what I read this will cause some testing to fail. I am not good yet with testing at this point so this is a bit beyond me. Do you know if this problem has been fixed?
    • this seems like it will cause me significant pain in the future that I'd like to avoid

While googleing around I found this as a possible solution which may work out:
http://xtargets.com/2011/08/02/tableless-views-with-active-record/

What would you do? Fix up the gem or try that tableless-view solution?

Quick thoughts!

The first question I would ask is: what makes you need views currently? (not trolling! in case I may have another suggestion).

For instance, are you using views for something reporting related etc?

If you still need views afterwards, I would definitely avoid the rails-sql-views gem for now, would stick to custom written sql code for the views, and probably switch to the :sql schema dumper (see http://guides.rubyonrails.org/migrations.html#types-of-schema-dumps).