PNixx / clickhouse-activerecord

A Ruby database ActiveRecord driver for ClickHouse
MIT License
202 stars 100 forks source link

feat(limit_by): Add support for LIMIT BY clause #169

Closed jdenquin closed 1 month ago

jdenquin commented 1 month ago

Usage :

# limit_by(<Integer>, <Symbol> or <String>)
events = Event.limit_by(1, :event_key)
events = Events.limit_by(1, :event_key)
sql = <<-SQL
  with events as (#{events.to_sql})
  SELECT count()
  FROM events
SQL
Events.connection.select_value(sql)
PNixx commented 1 month ago

@jdenquin please, fix conflicts

jdenquin commented 1 month ago

@jdenquin please, fix conflicts

done!