On Sunday, March 26, 2017 at 6:41:29 PM UTC-7, Andrew Burleson wrote:
>
> Would it be practical to add an alternative -- or perhaps this already 
>>> works -- of just using strings? eg.
>>>
>>> foo.join('users.id' => 'id')
>>>
>>
>> In most cases in Sequel, ruby strings are treated as SQL strings, so this 
>> wouldn't work.  There are a few cases where an SQL string is not valid 
>> where Sequel will treat a ruby string as an SQL identifier, but Sequel 
>> quotes identifiers by default, so you can't use . inside a string for a 
>> qualified identifier.  You can do Sequel.lit('users.id') to drop down to 
>> literal SQL, but that limits Sequel's introspection capabilities.
>>  
>>
>>> That, or perhaps the symbolized equivalent ( `:"users.id"`) would solve 
>>> pretty much every use of symbol splitting for me.
>>>
>>
>> That also doesn't work because Sequel quotes identifiers by default.
>>
>
> So then in the next major version of Sequel, what would your preferred 
> manner of qualifying column names be? The symbol subscript approach, eg. 
> :table_name[:column_name]  ?
>

This requires modifying a core class (Symbol), and therefore cannot be 
supported in core Sequel, it must remain an extension (symbol_aref).  That 
being said, symbol_aref is what I use in most of my applications.
 

> I think whatever method you prefer would be fine, but since queries that 
> require qualifying the table name to avoid ambiguity are a relatively 
> common case, I think it's nice to have a "standard" way to do this, and 
> preferable for the library to have "one way" to do most things rather than 
> may ways to do them.
>

The standard way is a bit long:

  Sequel[:table_name][:column_name]
 
The other, shorter ways require extensions.  So users have to decide 
whether they want to modify a core class to allow shorter code.

Thus, the other thought I'd have for you is, since you're introducing 
> deprecation warnings now, and since I presume your goal is to improve the 
> stability and consistency of the library with major versions, is that you 
> might want to just warn that the behavior is deprecated with 4.41 and 
> remove it on 5.0, rather than have it survive as an "optional feature" 
> through to 6.0 or later.
>

Removing the support completely would be nice, but I thought it may make 
upgrading too difficult for applications that used symbol splitting 
extensively (even though there exists a mostly automated conversion tool: 
https://github.com/jeremyevans/sequel-unsplit).  By just changing the 
default, you could always turn it back on if you want to use it in your 
application.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to