CurtHagenlocher commented on code in PR #2692: URL: https://github.com/apache/arrow-adbc/pull/2692#discussion_r2051038233
########## csharp/src/Drivers/Databricks/DatabricksConnection.cs: ########## @@ -86,9 +100,70 @@ protected override TOpenSessionReq CreateSessionRequest() Client_protocol_i64 = (long)TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V7, CanUseMultipleCatalogs = true, }; + + // If not using queries to set server-side properties, include them in Configuration + if (!_applySSPWithQueries) + { + req.Configuration = new Dictionary<string, string>(); + var serverSideProperties = GetServerSideProperties(); + foreach (var property in serverSideProperties) + { + req.Configuration[property.Key] = property.Value; + } + } return req; } + /// <summary> + /// Gets a dictionary of server-side properties extracted from connection properties. + /// </summary> + /// <returns>Dictionary of server-side properties with prefix removed from keys.</returns> + private Dictionary<string, string> GetServerSideProperties() + { + return Properties + .Where(p => p.Key.StartsWith(DatabricksParameters.ServerSidePropertyPrefix)) + .ToDictionary( + p => p.Key.Substring(DatabricksParameters.ServerSidePropertyPrefix.Length), + p => p.Value + ); + } + + /// <summary> + /// Applies server-side properties by executing "set key=value" queries. + /// </summary> + /// <returns>A task representing the asynchronous operation.</returns> + public async Task ApplyServerSidePropertiesAsync() + { + if (!_applySSPWithQueries) + { + return; + } + + var serverSideProperties = GetServerSideProperties(); + + if (serverSideProperties.Count == 0) + { + return; + } + + using var statement = new DatabricksStatement(this); + + foreach (var property in serverSideProperties) + { + string query = $"SET {property.Key}={property.Value}"; Review Comment: Thanks! You're sure that that quoting character will work? In most SQL dialects it's the apostrophe (U+0027) that's used for string literals while those that support the grave accent (U+0060) do so to escape identifiers? -- 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. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org