Skip to content

Conversation

@yinheli
Copy link

@yinheli yinheli commented Jan 5, 2026

Summary

This PR adds support for the Snowflake PDO driver (pdo_snowflake) extension, enabling PHP applications to connect to Snowflake databases using PDO.

Limitations

Alpine Linux Not Supported

Snowflake's PDO driver currently does not support Alpine Linux (musl libc). This is a known upstream limitation tracked in snowflakedb/pdo_snowflake#319.

Users requiring Alpine compatibility should use Debian-based images instead:

  • php:8.3-alpine
  • php:8.3-cli or php:8.3-fpm

PHP 8.5 Not Supported

PHP 8.5 introduces PDO API changes that pdo_snowflake has not yet adapted to. Support will be added when upstream releases a compatible version.

@yinheli yinheli changed the title Feature/add snowflake pdo driver Add snowflake pdo driver Jan 5, 2026
fi
;;
pdo_snowflake)
if test $PHP_MAJMIN_VERSION -lt 801; then
Copy link
Owner

Choose a reason for hiding this comment

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

I'd avoid this check: we don't do that for all the other extensions

printf 'pdo_snowflake requires PHP 8.1+\n' >&2
exit 1
fi
if ! command -v cmake >/dev/null 2>&1; then
Copy link
Owner

Choose a reason for hiding this comment

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

I'd avoid this check: we don't do that for all the other extensions, and the cmake is installed thanks to the code in the buildRequiredPackageLists function.

installRemoteModule_tmp1="$(cmake --version | head -1 | grep -oE '[0-9]+\.[0-9]+' | head -1)"
installRemoteModule_tmp2="$(echo "$installRemoteModule_tmp1" | cut -d. -f1)"
installRemoteModule_tmp3="$(echo "$installRemoteModule_tmp1" | cut -d. -f2)"
if test "$installRemoteModule_tmp2" -lt 3 || { test "$installRemoteModule_tmp2" -eq 3 && test "$installRemoteModule_tmp3" -lt 17; }; then
Copy link
Owner

Choose a reason for hiding this comment

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

I'd avoid this check: we don't do that for all the other extensions

printf 'cmake >= 3.17 required (detected: %s)\n' "$installRemoteModule_tmp1" >&2
exit 1
fi
if ! command -v gcc >/dev/null 2>&1; then
Copy link
Owner

Choose a reason for hiding this comment

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

I'd avoid this check: we don't do that for all the other extensions, and gcc is installed thanks to the code in the buildRequiredPackageLists function.

exit 1
fi
fi
installRemoteModule_tmp="$(getPackageSource "https://github.com/snowflakedb/pdo_snowflake/archive/refs/tags/v${installRemoteModule_version}.tar.gz")"
Copy link
Owner

Choose a reason for hiding this comment

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

Do we really need this check?

exit 1
fi
cd "$installRemoteModule_tmp"
export PHP_HOME="$(php-config --prefix)"
Copy link
Owner

Choose a reason for hiding this comment

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

Is the PHP_HOME variable required by build_pdo_snowflake.sh? If so, I'd simply write

PHP_HOME="$(php-config --prefix)" ./scripts/build_pdo_snowflake.sh

rm -rf "$installRemoteModule_tmp"
exit 1
fi
if ! test -f modules/pdo_snowflake.so; then
Copy link
Owner

Choose a reason for hiding this comment

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

I'd avoid this check: the following cp will fail (and the script will abort) if that .so file doesn't exist

@yinheli yinheli force-pushed the feature/add-snowflake-pdo-driver branch from ef2fe5f to 33e4ca6 Compare January 9, 2026 16:29
@mlocati
Copy link
Owner

mlocati commented Jan 9, 2026

Could you check the errors reported by CI?

PS: no need to force-push changes (it makes review harder): when I'll merge this PR I'll squash the commits.

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.

2 participants