feat(outputs.sql): Add oracle driver#19036
Open
sull1vxn wants to merge 5 commits into
Open
Conversation
srebhan
reviewed
Jun 5, 2026
Comment on lines
98
to
111
| switch p.Driver { | ||
| case "sqlite": | ||
| p.tableListColumnsTemplate = "SELECT name AS column_name FROM pragma_table_info({TABLE})" | ||
| case "oracle": | ||
| p.tableListColumnsTemplate = "SELECT column_name FROM all_tab_columns WHERE table_name = {TABLE}" | ||
| case "mssql", "mysql", "pgx", "snowflake", "clickhouse": | ||
| p.tableListColumnsTemplate = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME={TABLE}" | ||
| default: | ||
| return fmt.Errorf("unknown driver %q", p.Driver) // checks for valid driver | ||
| } | ||
|
|
||
| // Check for a valid driver | ||
| switch p.Driver { | ||
| case "clickhouse": | ||
| // Convert v1-style Clickhouse DSN to v2-style | ||
| if p.Driver == "clickhouse" { | ||
| p.convertClickHouseDsn() | ||
| case "mssql", "mysql", "pgx", "snowflake", "sqlite": | ||
| // Do nothing, those are valid | ||
| default: | ||
| return fmt.Errorf("unknown driver %q", p.Driver) | ||
| } |
Member
There was a problem hiding this comment.
Can we please merge this into
Suggested change
| switch p.Driver { | |
| case "sqlite": | |
| p.tableListColumnsTemplate = "SELECT name AS column_name FROM pragma_table_info({TABLE})" | |
| case "oracle": | |
| p.tableListColumnsTemplate = "SELECT column_name FROM all_tab_columns WHERE table_name = {TABLE}" | |
| case "mssql", "mysql", "pgx", "snowflake", "clickhouse": | |
| p.tableListColumnsTemplate = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME={TABLE}" | |
| default: | |
| return fmt.Errorf("unknown driver %q", p.Driver) // checks for valid driver | |
| } | |
| // Check for a valid driver | |
| switch p.Driver { | |
| case "clickhouse": | |
| // Convert v1-style Clickhouse DSN to v2-style | |
| if p.Driver == "clickhouse" { | |
| p.convertClickHouseDsn() | |
| case "mssql", "mysql", "pgx", "snowflake", "sqlite": | |
| // Do nothing, those are valid | |
| default: | |
| return fmt.Errorf("unknown driver %q", p.Driver) | |
| } | |
| switch p.Driver { | |
| case "sqlite": | |
| p.tableListColumnsTemplate = "SELECT name AS column_name FROM pragma_table_info({TABLE})" | |
| case "clickhouse": | |
| p.tableListColumnsTemplate = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME={TABLE}" | |
| p.convertClickHouseDsn() | |
| case "oracle": | |
| p.tableListColumnsTemplate = "SELECT column_name FROM all_tab_columns WHERE table_name = {TABLE}" | |
| case "mssql", "mysql", "pgx", "snowflake": | |
| p.tableListColumnsTemplate = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME={TABLE}" | |
| default: | |
| return fmt.Errorf("unknown driver %q", p.Driver) // checks for valid driver | |
| } | |
|
|
||
| func (p *SQL) updateTableCache(tablename string) error { | ||
| stmt := strings.ReplaceAll(p.tableListColumnsTemplate, "{TABLE}", quoteStr(tablename)) | ||
| fmt.Println(stmt) |
Member
There was a problem hiding this comment.
I guess that's a left-over from debugging? Please remove!
Suggested change
| fmt.Println(stmt) |
| if testing.Short() { | ||
| t.Skip("Skipping integration test in short mode") | ||
| } | ||
| const username = "system" |
Member
There was a problem hiding this comment.
Please directly use the value at the respective locations instead of defining a constant here! Same for the other tests below!
Contributor
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
Author
|
@srebhan I have adjusted the code according to your comments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Oracle support for
outputs/sqlplugin. Involved small additions to the code inoutputs/sql/sql.gowhich encouraged slight stylistic changes (namely converting some if blocks to switches). Also added 3 integration tests for the Oracle support.Checklist
Related issues
resolves #18959