Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Summary

This PR addresses issue #597 by documenting that sqlcmd's --sqlconfig flag only supports YAML format. Initial investigation revealed the underlying Viper library supports multiple formats, but the sqlcmd implementation hardcodes YAML format.

Root Cause

The implementation in internal/config/viper.go:

  • Line 68: viper.SetConfigType("yaml") - hardcodes YAML for reading
  • Line 46: yaml.Marshal(&config) - always marshals as YAML for writing

This means only YAML-formatted files work correctly for both read and write operations, regardless of file extension.

Changes Made

cmd/modern/root.go

  • Updated --sqlconfig flag help text to: "configuration file (YAML format, use .yaml or .yml extension)"

README.md

  • Added "Custom Configuration Files" section documenting YAML-only support
  • Clarified that configuration files must use YAML format with .yaml or .yml extension
  • Provided usage examples

Translation files

  • Added new localized help text string to all language catalogs
  • Preserved all existing translation entries

Testing

  • ✅ Verified .yaml and .yml files work correctly for read and write
  • ✅ Confirmed other formats (.json, .toml) write in their respective formats but fail to read back (parse errors)
  • ✅ All existing tests pass
  • ✅ Help text displays accurate information
  • ✅ README correctly documents the YAML-only limitation

The documentation now accurately reflects the actual implementation behavior.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add documentation/help about supported config types</issue_title>
<issue_description>Hi, sorry for my poor English.

I'm a newer to this sqlcmd utility, version 1.8.2, trying to use configuration files with --sqlconfig option to manage connection contexts.

Seems that sqlcmd sometimes use the configuration file's extension to determine which "config type" to use.
After some rough tests, seems recognized config types are:

  • .yaml
  • .yml
  • .toml
  • .json
  • .ini
  • (maybe others?)

Using other file extensions, like .sqlconfig, running command like

sqlcmd config --sqlconfig ./myproject.sqlconfig add-endpoint --name ep1434 --address localhost --port 1434

sqlcmd will complain:

Error: Unsupported Config Type "sqlconfig"

where sqlconfig seems to be the file extension.

However, commands that read (rather than write) configuration file seem to treat the configuration file as YAML-formatted,
e.g.

sqlcmd config --sqlconfig ./myproject.sqlconfig view

I'm not sure if I'm missing something, but so far I cannot find somewhere documented this behavior.
Or maybe there's a plan adding a list of supported config type / a guide of naming a configuration file?</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 31, 2026 19:57
Co-authored-by: dlevy-msft-sql <194277063+dlevy-msft-sql@users.noreply.github.com>
Co-authored-by: dlevy-msft-sql <194277063+dlevy-msft-sql@users.noreply.github.com>
Copilot AI changed the title [WIP] Add documentation for supported config types Document supported config file extensions for --sqlconfig flag Jan 31, 2026
Copilot AI requested a review from dlevy-msft-sql January 31, 2026 20:00
@dlevy-msft-sql dlevy-msft-sql added bug Something isn't working Size: S Small issue (less than one week effort) needs-work labels Feb 1, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses issue #597 by documenting the supported configuration file extensions for the --sqlconfig flag. Users were encountering "Unsupported Config Type" errors when using non-standard extensions like .sqlconfig without knowing which extensions are actually supported by Viper.

Changes:

  • Updated --sqlconfig flag help text to list supported extensions inline
  • Added comprehensive "Custom Configuration Files" section to README.md with examples
  • Regenerated translation catalogs for new localizable strings

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

File Description
cmd/modern/root.go Added inline documentation of supported extensions (.yaml, .yml, .json, .toml, .ini, .env, .properties) to the --sqlconfig flag help text
README.md Added new "Custom Configuration Files" section listing all supported extensions with format names, including variants and less common formats, plus usage examples and clarifying note about unsupported extensions
internal/translations/locales/*/out.gotext.json Regenerated translation catalogs with new help text string; non-English locales have empty translations awaiting human translation

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

@dlevy-msft-sql
Copy link
Contributor

@copilot address the review comments

Copilot AI and others added 2 commits February 1, 2026 05:50
…tions

Co-authored-by: dlevy-msft-sql <194277063+dlevy-msft-sql@users.noreply.github.com>
Co-authored-by: dlevy-msft-sql <194277063+dlevy-msft-sql@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 1, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • does
    • Triggering command: /tmp/go-build2543538777/b536/install.test /tmp/go-build2543538777/b536/install.test -test.testlogfile=/tmp/go-build2543538777/b536/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -I /tmp/net_C387458-ifaceassert x64/bin/go . oot}} {{.Goroot}-atomic --64 x64/bin/go -w -Wno-error -o/tmp/os_user_C-ifaceassert ux_amd64/vet -c oot}} {{.Goroot}-atomic /tmp/os_user_C18-bool ux_amd64/vet (dns block)
  • nonexistent.database.windows.net
    • Triggering command: /tmp/sqlcmd-e2e-847287666/sqlcmd /tmp/sqlcmd-e2e-847287666/sqlcmd -G -S nonexistent.database.windows.net -d testdb -compiler=gc ndor/bin/bash -installsuffix= oot}} {{.Goroot}-atomic -- hentication-libr-buildtags list�� -e store missing tr-ifaceassert ux_amd64/vet -installsuffix= mportPath}} {{.R-atomic -- ux_amd64/vet (dns block)
  • nonexistent.server
    • Triggering command: /tmp/sqlcmd-e2e-847287666/sqlcmd /tmp/sqlcmd-e2e-847287666/sqlcmd -S nonexistent.server -tests /tmp/go-build2543538777/b321/vet.cfg -e -compiler=gc ache/go/1.24.12/-nilfunc -installsuffix= oot}} {{.Goroot}-atomic -- nal/flags list�� -e store missing tr-ifaceassert ux_amd64/vet -installsuffix= mportPath}} {{.R-atomic -- ux_amd64/vet (dns block)
    • Triggering command: `/tmp/sqlcmd-e2e-847287666/sqlcmd /tmp/sqlcmd-e2e-847287666/sqlcmd -C -S nonexistent.server /tmp/go-build2543538777/b436/vet.cfg -I /tmp/os_user_C18-ifaceassert ache/go/1.24.12/-nilfunc . oot}}
      {{.Goroot}-test.testlogfile=/tmp/go-build3625500898/b001/testlog.txt --64 /v1.20.0 -W -I store missing translations

Co-authored-by: dlevy-msft-sql <194277063+dlevy-msft-sql@users.norep-o ux_amd64/vet . mportPath}}
{{.R-atomic --64 ux_amd64/vet` (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

@dlevy-msft-sql
Copy link
Contributor

@copilot fix the items in the review

Co-authored-by: dlevy-msft-sql <194277063+dlevy-msft-sql@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 1, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • does
    • Triggering command: /tmp/go-build3563136012/b536/install.test /tmp/go-build3563136012/b536/install.test -test.testlogfile=/tmp/go-build3563136012/b536/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true ndLinux.slice -mtune=generic x64/bin/go (dns block)
  • nonexistent.database.windows.net
    • Triggering command: /tmp/sqlcmd-e2e-3521548478/sqlcmd /tmp/sqlcmd-e2e-3521548478/sqlcmd -G -S nonexistent.database.windows.net -d testdb (dns block)
  • nonexistent.server
    • Triggering command: /tmp/sqlcmd-e2e-3521548478/sqlcmd /tmp/sqlcmd-e2e-3521548478/sqlcmd -S nonexistent.server -tests /tmp/go-build3563136012/b455/vet.cfg ndLinux.slice 02160869 x64/bin/go sVt9gHpKW oot}} {{.Goroot}-atomic cal/bin/git x64/bin/go 0216�� log.showsignatur-errorsas log ux_amd64/compile-nilfunc -n1 oot}} {{.Goroot}-atomic ff25b1343cfc ux_amd64/compile-buildtags (dns block)
    • Triggering command: /tmp/sqlcmd-e2e-3521548478/sqlcmd /tmp/sqlcmd-e2e-3521548478/sqlcmd -C -S nonexistent.server /tmp/go-build3563136012/b417/vet.cfg --noprofile /home/REDACTED/go/pkg/mod/golang.org/x/text@v0.33.-f={{.Dir}} {{.ImportPath}} {{.R/tmp/go-build3563136012/b536/importcfg x64/bin/go (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Document supported config file extensions for --sqlconfig flag Document that --sqlconfig flag only supports YAML format Feb 1, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working needs-work Size: S Small issue (less than one week effort)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation/help about supported config types

2 participants