Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the ability to pass query restriction parameters #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Clickhouse CHANGELOG

### Version 0.1.11 (September 10, 2018)

* Added the ability to pass query restriction parameters

### Version 0.1.10 (January 13, 2017)

* Fixed `erubis` dependency once and for all
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ Clickhouse.establish_connection
=> true
```

Establish the connection with the ClickHouse server using custom config

```ruby
config = {
url: 'url',
username: 'username',
password: 'password',
query_settings: {
timeout_overflow_mode: 'throw',
max_execution_time: 5
}
}
Clickhouse.connect(config)
```

List databases and tables.

```ruby
Expand Down
1 change: 1 addition & 0 deletions lib/clickhouse/connection/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def ensure_authentication

def path(query)
params = @config.select{|k, _v| k == :database}
params.merge!(@config[:query_settings]) if @config[:query_settings]
params[:query] = query
params[:output_format_write_statistics] = 1
query_string = params.collect{|k, v| "#{k}=#{CGI.escape(v.to_s)}"}.join("&")
Expand Down