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

move data to sql #143

Merged
merged 1 commit into from
Dec 29, 2023
Merged

move data to sql #143

merged 1 commit into from
Dec 29, 2023

Conversation

ruslandoga
Copy link
Contributor

This allows passing rows and params in a single query

{:ok, pid} = Ch.start_link()

Ch.query!(pid, "CREATE TABLE IF NOT EXISTS ch_demo(id UInt64) ENGINE Null")

# note `\n` at the end of SQL
sql = "INSERT INTO ch_demo SELECT id + {ego:Int64} FROM input('id UInt64') FORMAT RowBinary\n"
row_binary = Ch.RowBinary.encode_rows([[1], [2], [3]], ["UInt64"])

%Ch.Result{num_rows: 3} = Ch.query!(pid, [sql | row_binary], %{"ego" => -1})

@ruslandoga ruslandoga merged commit fe4ed23 into master Dec 29, 2023
7 checks passed
@ruslandoga ruslandoga deleted the move-data-to-sql branch December 29, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant