Hi,
I'm sorry my previous email was mistakenly wrong. This is the correct one.
I mixed up the queries.
with recursive pattern(pattern) as (
select string_to_array('folder_2/SUB iso', '/') -- input
),
full_paths as (
select id, base_folder_id, subject, 1 as idx
from folders
cross join
PM UTC+3, genc wrote:
>
> Hi,
>
> I'm sorry my previous email was mistakenly wrong. This is the correct one.
> I mixed up the queries.
>
>
> with recursive pattern(pattern) as (
> select string_to_array('folder_2/SUB iso', '/') -- input
> ),
> full_paths as (
>
ot; ON (("y"."id" = "pattern"
I think In your query, :pattern matched with :y instead of :x with :y when
inner join created. I tried to manually fix it but unable to do so.
Thanks,
Gencer.
On Thursday, October 11, 2018 at 10:34:12 PM UTC+3, Jeremy Evans wrote:
&g
Thank you so much, Jeremy.
Have a great weekend!,
Gencer.
On Thursday, October 11, 2018 at 9:31:06 PM UTC+3, genc wrote:
>
> Hi,
>
> I'm sorry my previous email was mistakenly wrong. This is the correct one.
> I mixed up the queries.
>
>
> with recursive pattern
Hi Jeremy,
I am trying to achieve this:
update files set name = '--DELETED--' || files.name
basically i would like to prepend deleted text to fields. How can I do that
with Sequel? I couldn't find any documentation about transforming existing
data on the fly with sequel.
I tried something
Hi Jeremy,
I dig into querying.md and can't find any example about "NOT EXISTS".
How can we write this query in Sequel:
select * from books where not exists (select * from writers where .)
Thanks,
Gencer.
--
You received this message because you are subscribed to the Google Groups
Thank you, Jeremy! It did worked.
One last question. About migrations. I have a few foreign keys already
declared and they are set to "on delete SET NULL". I would like to change
them to "on delete CASCADE". I know there was a way of doing this but
alter_table seems not mentioned about this.
not mentioned about this. How can I change cascade styule
for an existing foreign key using migrations?
Thanks,
Gencer.
On Tuesday, October 23, 2018 at 6:28:24 PM UTC+3, Jeremy Evans wrote:
>
> On Tuesday, October 23, 2018 at 7:46:47 AM UTC-7, genc wrote:
>>
>> Hi Jeremy,
>>
Thank you so much, Jeremy.
On Tuesday, October 23, 2018 at 5:46:47 PM UTC+3, genc wrote:
>
> Hi Jeremy,
>
> I dig into querying.md and can't find any example about "NOT EXISTS".
>
> How can we write this query in Sequel:
>
> select * from books where not e
Hi Jeremy,
I want to add more conditions to inner join after ON but it appends and
treat as array instead of merging conditions.
Let me show you the full query builder:
DB[:full_paths].
select(:id, :subject).
cross_join(:pattern).
where{{:idx=>cardinality(:pattern)}}.
with(:pattern,
Ah, I merged them with &
Sequel.expr { x[:user_id] =~ 4 } & ...
On Thursday, November 15, 2018 at 11:43:03 AM UTC+3, genc wrote:
>
> Hi Jeremy,
>
> I want to add more conditions to inner join after ON but it appends and
> treat as array instead of merging conditio
Hi Jeremy,
Sorry for previous question thread. I deleted it to not confusing.
This is what I am trying to do:
select sum(sp.storage_size) + sum(bp.storage_size) as storage_size
from subscriptions s
left join subscription_packages sp on s.subscription_package_id = sp.id
left join
trying to join previous join (subscription_packages) not the main
'subscriptions' table
.where(user: user)
Is there a wiser way to accomplish my query with Sequel?
Thanks,
Genc.
--
You received this message because you are subscribed to the Google Groups
"sequel-talk&q
I've achieved this by:
.where{ ( subscriptions[:expires_on] =~ nil ) | (subscriptions[:expires_on]
<= Time.now.utc) }.sql
On Monday, January 14, 2019 at 10:03:38 PM UTC+3, genc wrote:
>
> Hi Jeremy,
>
> Sorry for previous question thread. I deleted it to not confusing.
>
&
I also solved sum field as this:
Subscription.select{ (sum( Sequel[:bounty_packages][:storage_size]) + sum(
Sequel[:subscription_packages][:storage_size])).as(:size) }
Once again, Let me know if there is a better way.
On Monday, January 14, 2019 at 8:59:09 PM UTC+3, genc wrote:
>
> Hi
One thing thsat i couldn't solve is that how to fetch total sum column as
:storage_size.
select sum() + sum() as FIELD_NAME ...
In my scenario, there are two sums and i need to name them.
On Monday, January 14, 2019 at 9:36:11 PM UTC+3, genc wrote:
>
> As per documentation, I ac
[:subscriptions][:
bounty_package_id])
.where(user: user)
Let me know if there is a better way.
Thanks,
Genc.
On Monday, January 14, 2019 at 8:59:09 PM UTC+3, genc wrote:
>
> Hi Jeremy,
>
> This is my SQL query:
>
> select sum(sp.storage_size) + sum(bp.storage_size) as sto
Hi Jeremy,
When I do this:
class User < Sequel::Model
...
end
user = User.new
user.properties = { name: 'Genc', age: 42 } # or ':name =>..., '
user.save
#try to fetch assigned data
user.properties[:name] # => Genc
user.properties[:age] # => 42
However, If I fetch that data la
Hi Jeremy,
I have models like this:
class Mailbox::Email < Mailbox::Model(:emails)
end
class Mailbox::Post < Mailbox::Model(:emails)
end
and of course a base class:
module Mailbox
def self.Model(source)
c = Sequel::Model(second_db)
c.set_dataset(source)
end
# defining admin?
Gotcha.
Thanks Jeremy.
On Tuesday, December 25, 2018 at 6:37:58 PM UTC+3, genc wrote:
>
> Hi Jeremy,
>
> When I do this:
>
> class User < Sequel::Model
> ...
> end
>
> user = User.new
> user.properties = { name: 'Genc', age: 42 } # or ':name =>..., '
uesday, December 25, 2018 at 8:50:32 AM UTC-8, genc wrote:
>>
>> Hi Jeremy,
>>
>> I have models like this:
>>
>>
>> class Mailbox::Email < Mailbox::Model(:emails)
>> end
>> class Mailbox::Post < Mailbox::Model(:emails)
>> end
>>
>
no not dataset, connection is wrong. I tried to inbject in method but no
luck. Jeremy, How can I inject connection (second_db in this example) using
your way?
On Tuesday, December 25, 2018 at 10:31:42 PM UTC+3, genc wrote:
>
> Thanks Jeremy.
>
> But this time it doesn't se
Thanks Jeremy. It works like a charm. I just able to inject connection. I
was missing one line :)
On Tuesday, December 25, 2018 at 7:50:32 PM UTC+3, genc wrote:
>
> Hi Jeremy,
>
> I have models like this:
>
>
> class Mailbox::Email < Mailbox::Model(:emails)
> end
>
Hi Jeremy,
On PostgreSQL there is a string_to_array function. This is currently What I
am doing:
UPDATE files SET date="2007-10-10 10:50:22" WHERE id in(1,2,3,4,5..)
However, IDs can be very large and can be oversize for a query. Due to this
I woulşd like to send them as text and split
I have this sql line:
count(*) OVER (PARTITION BY sender->>'email') AS "count"
And I translated to this:
.select_append { count.function.over(partition: sender.get_text('email')).as
(:count) }
But this gives
count()
instead of
count(*)
This causes an error. How can i add asterisk to the
Ah figured out.
.select_append { Sequel.function(:count).*.over(partition: quiz_snapshot.
get_text('email')).as(:count) }
On Friday, May 24, 2019 at 2:03:54 AM UTC+3, genc wrote:
>
> I have this sql line:
>
> count(*) OVER (PARTITION BY sender->>'email') AS "count&q
Hi,
Is it possible to write this query with Sequel?
SELECT DISTINCT ON (x.e->>'email')
x.e->>'email' as email,
x.e->>'name' as name
FROM messages sr
CROSS JOIN LATERAL jsonb_array_elements(sr.receiver) x (e)
ORDER BY x.e->>'email', id desc
Or I use
27 matches
Mail list logo