Thank you very much Jeremy. I have already had the troubles you point. The problem is that that the columns in the database are so awful that make them totally unsable. I will try with the updateable query option. Many thanks. Juanma
On Nov 3, 10:58 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote: > On Nov 3, 4:51 am, jmcervera <[EMAIL PROTECTED]> wrote: > > > Hello > > I am new in this group and thinking in using sequel with odbc against > > a legacy SQL Server database. > > That database has a really awful design, really, and I would like to > > alias every column of the table. > > Is it posible? How can I do this with sequel. > > You can alias columns with: > > DB[:table].select(:ugly_name___pretty_name) > # or > DB[:table].select(:ugly_name.as(pretty_name)) > > If you are using models, you can set the dataset to include already > aliased columns: > > class Model < > Sequel::Model(DB[:table].select(:ugly_name.as(:pretty_name), > :ugly_name2.as(:pretty_name2))) > end > > You are going to problems if you do this and try to update records, > though. > > A better idea than this is to use an updateable database view that > gives the columns good names. If that is not possible, I'd just stick > with the bad names. I think you'll find that trying to get nice names > in ruby while keeping the ugly names in the database is more trouble > than it is worth. > > Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-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/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
