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

Support for delimiter param #4

Closed
wants to merge 7 commits into from
Closed

Conversation

nulldiego
Copy link

Add parameter "delimiter"

@mithrandie
Copy link
Owner

Thank you for creating a pull request, but I'm sorry, I'm not going to merge this request.

When opening this driver, there are three parameters that can be specified in the DNS string: Timezone, DatetimeFormat, AnsiQuotes. These parameters should be specified before parsing queries, and have a slightly different meaning than the other csvq options. For this reason, these can also be set at csvq runtime in the configuration file.

All other options can be specified at any time, so they are not available in the DNS string.

If you want to change the delimiter, you can use the following queries.

  1. Use SET FLAG statement.
r := db.QueryRowContext(ctx, "SET @@DELIMITER TO '\t'; SELECT col1, col2 FROM `data.csv`;")
  1. Use table function
r := db.QueryRowContext(ctx, "SELECT col1, col2 FROM CSV('\t', `data.csv`")

If you notice anything else, please let me know. Thank you.

@mithrandie mithrandie closed this Nov 12, 2021
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.

None yet

2 participants