Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "csharp/arrow-adbc"]
path = csharp/arrow-adbc
url = git@github.com:apache/arrow-adbc.git
branch = main
18 changes: 18 additions & 0 deletions .rat-apache
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.

csharp/src/Interop/Build-SnowflakeDriver.ps1
csharp/src/Interop/copySnowflakeDriver.sh
csharp/src/Interop/SnowflakeDriverLoader.cs
csharp/src/Interop/readme.md
csharp/test/Interop/CastTests.cs
csharp/test/Interop/ClientTests.cs
csharp/test/Interop/ConstraintTests.cs
csharp/test/Interop/DriverTests.cs
csharp/test/Interop/ErrorHandlingTests.cs
csharp/test/Interop/NumericOperatorTests.cs
csharp/test/Interop/readme.md
csharp/test/Interop/Resources/SnowflakeConstraints.sql
csharp/test/Interop/Resources/SnowflakeData.sql
csharp/test/Interop/SnowflakeData.cs
csharp/test/Interop/SnowflakeTestConfiguration.cs
csharp/test/Interop/SnowflakeTestingUtils.cs
csharp/test/Interop/ValueTests.cs

go/binding.go
go/bulk_ingestion.go
go/bulk_ingestion_test.go
Expand Down
1 change: 1 addition & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
go/license.tpl
go/validation/queries/*/*.json
go/validation/queries/*/*.sql
csharp/test/Interop/Resources/snowflakeconfig.json
29 changes: 29 additions & 0 deletions csharp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2025 ADBC Drivers Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

.vs
.vscode
bin
obj
x64
*.dll
*.lib
*.obj
*.exe
*.csproj.user
*.pass

artifacts/
TestResults/
packages/
62 changes: 62 additions & 0 deletions csharp/AdbcDrivers.Snowflake.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33403.182
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Arrow.Adbc", "arrow-adbc\csharp\src\Apache.Arrow.Adbc\Apache.Arrow.Adbc.csproj", "{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Arrow.Adbc.Telemetry.Traces.Listeners", "arrow-adbc\csharp\src\Telemetry\Traces\Listeners\Apache.Arrow.Adbc.Telemetry.Traces.Listeners.csproj", "{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Arrow.Adbc.Testing", "arrow-adbc\csharp\test\Apache.Arrow.Adbc.Tests\Apache.Arrow.Adbc.Testing.csproj", "{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Arrow.Adbc.Client", "arrow-adbc\csharp\src\Client\Apache.Arrow.Adbc.Client.csproj", "{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdbcDrivers.Snowflake.Interop", "src\Interop\AdbcDrivers.Snowflake.Interop.csproj", "{3750A5D6-4C21-3854-8449-E81F94EA61DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdbcDrivers.Snowflake.Interop.Tests", "test\Interop\AdbcDrivers.Snowflake.Interop.Tests.csproj", "{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9}.Release|Any CPU.Build.0 = Release|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00}.Release|Any CPU.Build.0 = Release|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51}.Release|Any CPU.Build.0 = Release|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62}.Release|Any CPU.Build.0 = Release|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3750A5D6-4C21-3854-8449-E81F94EA61DA}.Release|Any CPU.Build.0 = Release|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E63DF1C-ED91-B9F3-064F-D6779FE1AC4F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8BFC2CBA-D9B9-C719-0617-59A21A7D7DF9} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{CE59B9B8-E2D9-68B5-D25D-6CC418E5BE00} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{9C9EDBEB-BAE2-E3C2-BD74-7E34C6AFEE51} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{80163E19-0794-37AE-1FA0-FFFA6A2DEC62} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4795CF16-0FDB-4BE0-9768-5CF31564DC03}
EndGlobalSection
EndGlobal
52 changes: 52 additions & 0 deletions csharp/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!--
Copyright (c) 2025 ADBC Drivers Contributors

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<Project>

<!-- Common repo directories -->
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)../</RepoRoot>
<CSharpDir>$(MSBuildThisFileDirectory)</CSharpDir>
<BaseOutputPath>$(CSharpDir)/artifacts/$(MSBuildProjectName)</BaseOutputPath>
</PropertyGroup>

<!-- AssemblyInfo properties -->
<PropertyGroup>
<Product>ADBC Driver for Snowflake</Product>
<Copyright>Copyright 2025 ADBC Drivers Contributors</Copyright>
<VersionPrefix>0.22.0</VersionPrefix>
<VersionSuffix>SNAPSHOT</VersionSuffix>
</PropertyGroup>

<PropertyGroup>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<LangVersion>latest</LangVersion>
<SignAssembly>true</SignAssembly>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
</PropertyGroup>

<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net8.0'))">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions csharp/arrow-adbc
Submodule arrow-adbc added at 2fb3af
65 changes: 65 additions & 0 deletions csharp/src/Interop/AdbcDrivers.Snowflake.Interop.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net472;net8.0</TargetFrameworks>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<IsPackagingPipeline Condition="'$(IsPackagingPipeline)' == ''">
false
</IsPackagingPipeline>
</PropertyGroup>

<!-- use Build-SnowflakeDriver.ps1 to build the dll -->
<Target Name="PreBuild_Win" BeforeTargets="DispatchToInnerBuilds" Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<Exec Command="powershell -ExecutionPolicy Unrestricted -File $(ProjectDir)Build-SnowflakeDriver.ps1" />
</Target>

<!-- use copySnowflakeDriver.sh to move all the platform binaries when used in the pipeline -->
<Target Name="PreBuild_Linux" BeforeTargets="DispatchToInnerBuilds" Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<Exec Command="bash $(ProjectDir)copySnowflakeDriver.sh" />
</Target>

<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<Content Include="readme.md">
<Pack>true</Pack>
<PackagePath>/</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="libadbc_driver_snowflake.dll" Condition="'$(IsPackagingPipeline)' == 'true'">
<Pack>true</Pack>
<PackagePath>runtimes/win-x64/native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<!-- What runs in the pipeline. Assumes the Go builds have happened. -->
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<Content Include="readme.md">
<Pack>true</Pack>
<PackagePath>/</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<!-- Windows/DLLs -->
<Content Include="libadbc_driver_snowflake.dll" Condition="'$(IsPackagingPipeline)' == 'true'">
<Pack>true</Pack>
<PackagePath>runtimes/win-x64/native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<!-- Linux/so -->
<Content Include="libadbc_driver_snowflake.so" Condition="'$(IsPackagingPipeline)' == 'true'">
<Pack>true</Pack>
<PackagePath>runtimes/linux-x64/native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<!-- Mac/dylib -->
<Content Include="libadbc_driver_snowflake.dylib" Condition="'$(IsPackagingPipeline)' == 'true'">
<Pack>true</Pack>
<PackagePath>runtimes/osx-x64/native</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\arrow-adbc\csharp\src\Apache.Arrow.Adbc\Apache.Arrow.Adbc.csproj" />
</ItemGroup>
</Project>
85 changes: 85 additions & 0 deletions csharp/src/Interop/Build-SnowflakeDriver.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copyright (c) 2025 ADBC Drivers Contributors

# This file has been modified from its original version, which is
# under the Apache License:
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Write-Host "Building the Snowflake ADBC Go driver"
Write-Host "IsPackagingPipeline=$Env:IsPackagingPipeline"
Write-Host "IncludeGoSymbols=$Env:IncludeGoSymbols"

if (-not (Test-Path env:IsPackagingPipeline)) {
Write-Host "IsPackagingPipeline environment variable does not exist."
exit
}

# Get the value of the IsPackagingPipeline environment variable
$IsPackagingPipelineValue = $env:IsPackagingPipeline

# Get the value of the IncludeGoSymbols environment variable, default to false if not set
if (-not (Test-Path env:IncludeGoSymbols)) {
Write-Host "IncludeGoSymbols environment variable does not exist. Defaulting to 'false'."
$IncludeGoSymbolsValue = "false"
} else {
$IncludeGoSymbolsValue = $env:IncludeGoSymbols
}

# Check if the value is "true"
if ($IsPackagingPipelineValue -ne "true") {
Write-Host "IsPackagingPipeline is not set to 'true'. Exiting the script."
exit
}

$location = Get-Location

$file = "libadbc_driver_snowflake.dll"

if(Test-Path $file)
{
exit
}

cd ..\..\..\go\

if ($IncludeGoSymbolsValue -ne "true") {
Write-Host "Building without symbols"
pixi run make
} else {
Write-Host "Building with symbols"
go build -buildmode=c-shared -tags=driverlib -o build\$file -ldflags "-s=0 -w=0 -X github.com/adbc-drivers/driverbase-go/driverbase.infoDriverVersion=unknown-dirty" -gcflags="all=-N -l" ./pkg
}

cd build

if(Test-Path $file)
{
try {
Write-Host "Copying file with robocopy (5 retries, 2 second wait)..."
robocopy . $location $file /R:5 /W:2 /NP

if ($LASTEXITCODE -le 7) {
Write-Host "File copied successfully. Exit code: $LASTEXITCODE"
} else {
Write-Host "Failed to copy file. Robocopy exit code: $LASTEXITCODE"
exit 1
}
}
catch {
Write-Host "Caught error: $_"
}
}
49 changes: 49 additions & 0 deletions csharp/src/Interop/SnowflakeDriverLoader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2025 ADBC Drivers Contributors
*
* This file has been modified from its original version, which is
* under the Apache License:
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System.IO;
using Apache.Arrow.Adbc;

namespace AdbcDrivers.Snowflake.Interop
{
/// <summary>
/// Lightweight class for loading the Snowflake Go driver to .NET.
/// </summary>
public class SnowflakeDriverLoader : AdbcDriverLoader
{
public SnowflakeDriverLoader() : base("libadbc_driver_snowflake", "AdbcDriverSnowflakeInit")
{

}

/// <summary>
/// Loads the Snowflake Go driver from the current directory using the default name and entry point.
/// </summary>
/// <returns>An <see cref="AdbcDriver"/> based on the Snowflake Go driver.</returns>
/// <exception cref="FileNotFoundException"></exception>
public static AdbcDriver LoadDriver()
{
return new SnowflakeDriverLoader().FindAndLoadDriver();
}
}
}
Loading
Loading