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

String array insert not working #1

Open
finist opened this issue Nov 16, 2016 · 1 comment
Open

String array insert not working #1

finist opened this issue Nov 16, 2016 · 1 comment

Comments

@finist
Copy link

finist commented Nov 16, 2016

Clickhouse.connection.create_table("events") do |t|
  t.fixed_string :id, 16
  t.array       :array_data, 'String'
  t.date        :date
  t.engine       "MergeTree(date, (date), 8192)"
end
Clickhouse.connection.insert_rows("events", :names => %w(id array_data date)) do |rows|
  rows << ["d91d1c90", ["1", "2"], "2016-10-17"]
end
Clickhouse::QueryError: Code: 26, e.displayText() = DB::Exception: Cannot parse quoted string: expected opening quote: 

Row 1:
Column 0,   name: id,         type: FixedString(16), parsed text: "d91d1c90"
Column 1,   name: array_data, type: Array(String),   parsed text: <EMPTY>ERROR

It happens because CSV generate array with double quotes, and Clickhouse cant understand this format

\"[\"1\", \"2\"]\"

Worked example with single quotes:

Clickhouse.connection.execute("INSERT INTO events FORMAT CSV \"d91d1c90\",\"['1','2']\",\"2016-10-17\"")
@macEar
Copy link

macEar commented Feb 16, 2022

Any updates on this issue?

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

No branches or pull requests

2 participants