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

msdsn package should support azuresql:// driver name #768

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dagss
Copy link
Contributor

@dagss dagss commented Aug 25, 2022

Attempting to switch to the new AD connector in azuread package instead of our in-house homegrown connector. When using msdsn.Parse with azuresql:// it parses the string the wrong way.

@dagss
Copy link
Contributor Author

dagss commented Aug 25, 2022

Sorry, pushed prematurely. Fixing.

@codecov
Copy link

codecov bot commented Aug 25, 2022

Codecov Report

Merging #768 (3bd6584) into master (1598eaf) will decrease coverage by 0.11%.
The diff coverage is n/a.

❗ Current head 3bd6584 differs from pull request most recent head f49b1da. Consider uploading reports for the commit f49b1da to get more accurate results

@@            Coverage Diff             @@
##           master     #768      +/-   ##
==========================================
- Coverage   71.32%   71.21%   -0.12%     
==========================================
  Files          24       24              
  Lines        5388     5388              
==========================================
- Hits         3843     3837       -6     
- Misses       1301     1305       +4     
- Partials      244      246       +2     
Impacted Files Coverage Δ
tds.go 65.49% <0.00%> (-0.73%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dagss
Copy link
Contributor Author

dagss commented Aug 25, 2022

Force-pushed proper fix + test coverage

Copy link
Collaborator

@kardianos kardianos left a comment

Choose a reason for hiding this comment

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

I don't know why you need to have a azuresql:// prefix. I don't understand this need. I don't think we would want to add Schema in Config. I would be okay with returning a "schema" value within the map[string]string return value, that would be set within splitConnectionStringURL.

@@ -117,7 +118,7 @@ func Parse(dsn string) (Config, map[string]string, error) {
return p, params, err
}
params = parameters
} else if strings.HasPrefix(dsn, "sqlserver://") {
} else if strings.HasPrefix(dsn, "sqlserver://") || strings.HasPrefix(dsn, "azuresql://") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we do this, let's create a global regexp:
^[a-zA-Z]+:\/\/

To test for this.

@@ -127,6 +128,11 @@ func Parse(dsn string) (Config, map[string]string, error) {
params = splitConnectionString(dsn)
}

p.Scheme = "sqlserver"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would not go here.

@dagss
Copy link
Contributor Author

dagss commented Oct 11, 2022

The azuresql:// prefix is not my idea and I found it inconvenient... it is part of the "azuread" subpackage that is already merged and I just followed the lead from there.

I would much prefer if the AD options were possible to pass on a standard sqlserver:// DSN

@shueybubbles
Copy link
Contributor

@dagss the separate azuread package was designed to avoid pulling in azure dependencies for apps that didn't want to use AAD ever.
If there's a better model for it, I'm happy to consider it.
Also, there's been very little traffic in this original repo and we are taking PRs actively at github.com/microsoft/go-mssqldb

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

4 participants