On Fri, Jun 11, 2021 at 12:11 PM Billy Zheng <[email protected]> wrote:

>
> Following is a sample code .
>
> 57] pry(main)> Stock.association_join(:exchange).qualify.select_append(
> Sequel[:exchange][:name].as(:exchange_name))
>
> #<Sequel::SQLite::Dataset: "SELECT `stocks`.*, `exchange`.`name` AS
> 'exchange_name' FROM `stocks` INNER JOIN `exchanges` AS 'exchange' ON
> (`exchange`.`id` = `stocks`.`exchange_id`)">
>
> It works as expected, but, how to change `select_append(Sequel[:exchange][
> :name].as(:exchange_name))  ` part to rewriite with indentifier alias ?
>

The above correctly creates an alias, so I'm not sure what needs rewriting.


>
> Thank you.
> 在2021年6月12日星期六 UTC+8 上午3:08:13<Billy Zheng> 写道:
>
>>
>> I see a answer for Identifier aliases
>> <https://github.com/jeremyevans/sequel#identifier-aliases> in SO
>>
>> https://stackoverflow.com/a/27758411/749774
>>
>> but after some search, i could not find out the official document for
>> this.
>>
>
In terms of the documentation on aliasing:

http://sequel.jeremyevans.net/rdoc/files/README_rdoc.html#label-Expression+aliases
http://sequel.jeremyevans.net/rdoc/files/doc/sql_rdoc.html#label-Aliasing


>
>> and i don't understood the two/three underscore what means, it those usage
>> was available on sqlite3 ?
>>
>
The two/three underscore handling was a historical way to handle
qualification and aliasing.  It was disabled by default in Sequel 5, almost
4 years ago.  You can still use it by setting Sequel.split_symbols = true,
but it's recommended you don't, as it will probably be going away at some
point (likely in Sequel 6).

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSSf_qKsMSUtFFJjj4bsqRe-CM-CgTPpTNVWxj0-5gW4Fng%40mail.gmail.com.

Reply via email to