Skip to content

build(rust/driver/snowflake): include go source in package, add env override #2786

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mbrobbel
Copy link
Member

@mbrobbel mbrobbel commented May 6, 2025

Closes #2783.

This adds a symlink to the go source to the Snowflake driver, which means cargo will include it in the package. This means the build script now works after packaging. This also adds support to override this with an env var (ADBC_GO_SRC_DIR).

@mbrobbel mbrobbel requested a review from wjones127 as a code owner May 6, 2025 09:00
@github-actions github-actions bot added this to the ADBC Libraries 19 milestone May 6, 2025
@mbrobbel mbrobbel requested review from lidavidm and kou as code owners May 6, 2025 09:22
Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

Hmm, in lieu of the symlink, I don't mind the old approach, so long as it can be overridden by the release script

@mbrobbel
Copy link
Member Author

mbrobbel commented May 7, 2025

Hmm, in lieu of the symlink, I don't mind the old approach, so long as it can be overridden by the release script

Is there a reason you don't want the symlink? If we don't have a symlink we must either:

  1. accept that users must provide the Go Snowflake driver source to use this crate with the bundled feature, which means they must download/clone this repo elsewhere and set the env var to point to it.
  2. copy the source files in the build script so they can be packaged

I think the package should be usable without doing anything special i.e. we should package the required source for the bundled feature. If we don't want a symlink I propose to do option 2.

@kou
Copy link
Member

kou commented May 7, 2025

It may not be related to ADBC but... In general, UNIX style symlink doesn't work on Windows. For example, MSYS2 can't extract .tar.gz that has symlink. So apache/arrow resolves symlinks in its release process: https://github.com/apache/arrow/blob/5652af6631f8035d2c7fea9236767b6b392cbbac/dev/release/utils-create-release-tarball.sh#L46-L50

@mbrobbel
Copy link
Member Author

mbrobbel commented May 7, 2025

It may not be related to ADBC but... In general, UNIX style symlink doesn't work on Windows. For example, MSYS2 can't extract .tar.gz that has symlink. So apache/arrow resolves symlinks in its release process: https://github.com/apache/arrow/blob/5652af6631f8035d2c7fea9236767b6b392cbbac/dev/release/utils-create-release-tarball.sh#L46-L50

As long as we package the crate for publishing on linux it will work fine on systems that don't support symlinks. The files will be copied into the package:

arrow-adbc/rust on  snowflake-publish [$] is 📦 v0.18.0 via 🦀 v1.86.0
❯ cargo package -p adbc_snowflake --list
.cargo_vcs_info.json
.gitignore
Cargo.lock
Cargo.toml
Cargo.toml.orig
README.md
build.rs
go/adbc/LICENSE.txt
go/adbc/adbc.go
go/adbc/driver/internal/driverbase/connection.go
go/adbc/driver/internal/driverbase/database.go
go/adbc/driver/internal/driverbase/driver.go
go/adbc/driver/internal/driverbase/driver_info.go
go/adbc/driver/internal/driverbase/driver_info_test.go
go/adbc/driver/internal/driverbase/driver_test.go
go/adbc/driver/internal/driverbase/error.go
go/adbc/driver/internal/driverbase/logging.go
go/adbc/driver/internal/shared_utils.go
go/adbc/driver/snowflake/binding.go
go/adbc/driver/snowflake/bulk_ingestion.go
go/adbc/driver/snowflake/bulk_ingestion_test.go
go/adbc/driver/snowflake/concat_reader.go
go/adbc/driver/snowflake/connection.go
go/adbc/driver/snowflake/driver.go
go/adbc/driver/snowflake/driver_test.go
go/adbc/driver/snowflake/queries/get_objects_all.sql
go/adbc/driver/snowflake/queries/get_objects_dbschemas.sql
go/adbc/driver/snowflake/queries/get_objects_tables.sql
go/adbc/driver/snowflake/queries/get_objects_terse_catalogs.sql
go/adbc/driver/snowflake/record_reader.go
go/adbc/driver/snowflake/snowflake_database.go
go/adbc/driver/snowflake/statement.go
go/adbc/ext.go
go/adbc/go.mod
go/adbc/go.sum
go/adbc/infocode_string.go
go/adbc/pkg/Makefile
go/adbc/pkg/_tmpl/driver.go.tmpl
go/adbc/pkg/_tmpl/utils.c.tmpl
go/adbc/pkg/_tmpl/utils.h.tmpl
go/adbc/pkg/doc.go
go/adbc/pkg/snowflake/driver.go
go/adbc/pkg/snowflake/utils.c
go/adbc/pkg/snowflake/utils.h
go/adbc/standard_schemas.go
go/adbc/status_string.go
go/adbc/tools.go
go/adbc/utils/utils.go
src/builder.rs
src/connection/builder.rs
src/connection.rs
src/database/builder.rs
src/database.rs
src/driver/builder.rs
src/driver.rs
src/duration.rs
src/lib.rs
src/statement.rs
tests/driver.rs

@kou
Copy link
Member

kou commented May 7, 2025

Symlinks in source archive may have a problem when msys2/MINGW-packages#21803 is implemented. It's not related to Rust crates. We can solve it by resolving symlinks in release process like apache/arrow does.

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.

dev/release: rust post-release script requires manual intervention
3 participants