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

fix: sql unsigned settings #10673

Merged
merged 4 commits into from
Mar 3, 2022
Merged

Conversation

powersj
Copy link
Contributor

@powersj powersj commented Feb 17, 2022

Fixes: #10671

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Feb 17, 2022
@powersj powersj marked this pull request as draft February 17, 2022 14:50
@powersj
Copy link
Contributor Author

powersj commented Feb 17, 2022

@reimda curious your thoughts on this PR and the bug. I wanted to put up the PR with the proposed changes for the reporter to even try them, but I am not sure of the validity of these changes.

@crabvk
Copy link

crabvk commented Feb 17, 2022

Thank you for the fix, it's working.
Btw, there's small typo in the docs, it should be "UInt8".

plugins/outputs/sql/README.md Outdated Show resolved Hide resolved
plugins/outputs/sql/sql.go Outdated Show resolved Hide resolved
@powersj powersj marked this pull request as ready for review February 17, 2022 18:15
@powersj powersj added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Feb 22, 2022
Allow the user to specify a specific unsigned value to use for
converstion rather than assume the integer value + unsigned. This is
done via a new option.

Additionally, this actually adds tests for the uint64 and float64
datatypes across clickhouse, mariadb, and postgres. Because postgres
does not have support for unsigned values, the number is treated as a
bigint.

Fixes: influxdata#10671
Copy link
Contributor

@reimda reimda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the doc change it looks good to me

plugins/outputs/sql/README.md Outdated Show resolved Hide resolved
Co-authored-by: reimda <reimda@users.noreply.github.com>
plugins/outputs/sql/sql.go Outdated Show resolved Hide resolved
Co-authored-by: Mya <myalongmire05@gmail.com>
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Mar 2, 2022

Copy link
Contributor

@MyaLongmire MyaLongmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :)

@powersj powersj merged commit 008e43b into influxdata:master Mar 3, 2022
@powersj powersj deleted the fix/sql-unsigned branch March 3, 2022 15:21
MyaLongmire pushed a commit that referenced this pull request Jul 6, 2022
@timetofaceit
Copy link

timetofaceit commented May 30, 2023

Hi!

I would like to reopen this issue, because I'm still getting the same problem:

[agent] Error writing to outputs.sql: code: 62, message: Syntax error: failed at position 133 ('UInt64'): UInt64,"err_out" Int64 UInt64,"drop_in" Int64 UInt64,"drop_out" Int64 UInt64,"bytes_sent" Int64 UInt64,"bytes_recv" Int64 UInt64,"packets_sent" Int64 UInt64,"pa. Expected one of: COLLATE, NOT, NULL, DEFAULT, MATERIALIZED, ALIAS, EPHEMERAL, AUTO_INCREMENT, COMMENT, CODEC, TTL, token, Comma, ClosingRoundBracket

This is my telegraf config:

[[outputs.sql]]
  driver = "clickhouse"
  data_source_name = "tcp://MY_IP:9000?username=user&password=pass&database=database"
  table_template = "CREATE TABLE {TABLE}({COLUMNS}) ENGINE = MergeTree() ORDER by timestamp"
  [outputs.sql.convert]
    integer = "Int64"
    real = "Float64"
    text = "String"
    timestamp = "DateTime"
    defaultvalue = "String"
    unsigned = "UInt64"
    bool = "UInt8"

Any ideas what could be wrong here? Telegraf version is latest - 1.26.3
@powersj @crabvk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong behavior of outputs.sql.convert unsigned setting
5 participants