Good and reasonable suggestions.  I'd rather avoid supplementing the
database end of things.  The complete data set is fairly small <20,000
rows and queries are likely to only return 1,000 rows at a time.  I
don't think the string parsing is <i>that</i> complex, a couple of
seconds would be OK, 10 seconds, not so much.  It's for read-only
reports, so I don't really care about preserving the record integrity.
I'm wondering whether it makes sense to do half the processing in the
controller/model, and half in some helper (for the screen aspect).

On Oct 6, 10:03 am, Marnen Laibow-Koser <[email protected]> wrote:
> jrq wrote:
> > I've inherited an EAV database and there's really no option to remodel
> > it.  
>
> Why not?  Are others depending on the existing schema?
>
> > Data is stored as key_name, key_value pairs
> > Trying to return a meaningful, unified recordset is far too complex to
> > be efficient.
> > I've decided to make use of the MySQL GROUP_CONCAT, and CONCAT_WS
> > functions to return a fast query result, with the consolidated fields
> > as one string.
> > The final data is to be displayed and downloaded (CSV), but not all
> > fields will be available for each "row", which makes serialization
> > awkward.  I can't decide where the "heavy lifting" should go to parse
> > and process this data for screen and download.
>
> > Does anyone have a good strategy for this?
>
> If you can't remodel the DB, decline the project. :)
>
> If you can't decline the project, export the data into a reasonable
> schema (a non-SQL database like MongoDB may be a good option here).  A
> Google search also turned up the acts_as_eav_model plugin, but I know
> nothing about it.
>
> Another alternative: build a RESTful service (perhaps without Rails) on
> top of the EAV database, then connect Rails to it through
> ActiveResource.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> [email protected]
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to