You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/08/13 15:32:37 UTC

[GitHub] [calcite-avatica-go] joshelser commented on a change in pull request #54: [CALCITE-4174] avatica-go should handle complex/long URLs (josiahg)

joshelser commented on a change in pull request #54:
URL: https://github.com/apache/calcite-avatica-go/pull/54#discussion_r470040326



##########
File path: dsn.go
##########
@@ -207,7 +207,8 @@ func ParseDSN(dsn string) (*Config, error) {
 	}
 
 	if parsed.Path != "" {
-		conf.schema = strings.TrimPrefix(parsed.Path, "/")
+		s := strings.Split(parsed.Path, "/")
+		conf.schema = s[len(s)-1]

Review comment:
       This is pretty subtle now, in that the trailing slash is important.
   
   `https://some.host/proxied/avatica` is unique to `https://some.host/proxied/avatica/` in that the first is parsed as: `{'endpoint':'https://some.host/proxied', 'schema':'avatica'}` and the second is parsed as `{'endpoint':'https://some.host/proxied/avatica', 'schema':'avatica'}`.
   
   Looking at other DSN's, this is a pretty common convention. However, most databases don't allow/expose querying from behind a normal http loadbalancer ;)
   
   Is it going to be less error prone if we let the default schema to be provided via a query string instead of the path?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org