Hi Jeremy,
Thanks for the response. Unfortunately, Symbol#identifier doesn't work
as mentioned in the original post. It will create the table but it
seems like it fails in some other method like #insert or #update or
#filter or something. Not sure where as it just stopped responding and
I didn't do a section by section test.
I've added a bunch of features to Sequel (planned open sourcing later)
and one of them is namespacing. So, for example, you can take a
database object and namespace it something like this:
namespaced_database = database['john_doe']
You can then create a dataset out of it by giving the database a
model.
namespaced_database.dataset( ProductModel )
ProductModel is configured to be named "products"
The dataset will point to a table named "john_doe__products".
The benefit of this is that you can reuse a model within the same
database. For example, I can have both a "john_doe__products" and a
"jane_doe__products" table that are different but use the same model.
I use the underscore to prevent naming conflicts. For example, another
database may be namespaced "john" and "joe" and would result in
"john__doe__products" which is different from "john_doe__products".
So in other words, this isn't to support basic table names but rather
"name spaced" table names.
Sunny
On Nov 3, 5:45 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote:
> On Nov 3, 3:23 pm, Sunny Hirai <[EMAIL PROTECTED]> wrote:
>
> > Is there any way to use double underscores in table names?
>
> > I am name spacing tables. For example, if I want to put a "products"
> > table in the "store" name space, I want to use the table name
> > "store__products". The double underscore is important as it
> > differentiates it from a table named simply "store_products" without a
> > name space.
>
> > Unfortunately, I tried to use both String#lit and Symbol#identifier
> > and they both don't work.
>
> You are going to be fighting Sequel with that naming convention, but
> it should work:
>
> DB[:store__products.identifier].sql
> => "SELECT * FROM `store__products`"
> DB.from('store__products').sql
> => "SELECT * FROM `store__products`"
>
>
>
> > This is somewhat important to my implementation and I'd hate to use
> > something like "_and_" as the separator since it is both harder to
> > understand and longer to read.
>
> > e.g.
>
> > store__catalog__products
>
> > is easier to visually understand than
>
> > store_and_catalog_and_products
>
> > Thanks.
>
> > BTW, as always, I'm a huge fan of this project and have been
> > advocating it to whomever I speak to. Love your work guys.
>
> I don't understand why you think store__products is a better name than
> store_products, but I suppose you have your reasons. You may have
> issues with Sequel if you go this route, so you should make sure you
> are convinced that the benefits are worth the costs. Using
> Symbol#identifier or other methods should fix the issues, but if it
> doesn't, feel free to post issues on the tracker or send me pull
> requests.
>
> 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
-~----------~----~----~----~------~----~------~--~---