Skip to content
Draft
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
40 changes: 35 additions & 5 deletions .github/workflows/cpp_extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ jobs:

odbc-linux:
needs: check-labels
name: ODBC Linux
name: ODBC ${{ matrix.build-type }} ${{ matrix.title }}
runs-on: ubuntu-latest
if: >-
needs.check-labels.outputs.force == 'true' ||
Expand All @@ -359,6 +359,15 @@ jobs:
timeout-minutes: 75
strategy:
fail-fast: false
matrix:
include:
- image: ubuntu-cpp-odbc
title: AMD64 Ubuntu RPM
build-type: release
format: rpm
run-options: >-
-e ARROW_FLIGHT_SQL_ODBC_INSTALLER=ON
-e ODBC_PACKAGE_FORMAT=RPM
env:
ARCH: amd64
ARCHERY_DEBUG: 1
Expand All @@ -376,8 +385,8 @@ jobs:
uses: actions/cache@v5
with:
path: .docker
key: ubuntu-cpp-odbc-${{ hashFiles('cpp/**') }}
restore-keys: ubuntu-cpp-odbc-
key: ${{ matrix.image }}-${{ matrix.format }}-${{ hashFiles('cpp/**') }}
restore-keys: ${{ matrix.image }}-${{ matrix.format }}-
- name: Setup Python on hosted runner
uses: actions/setup-python@v6
with:
Expand All @@ -392,7 +401,14 @@ jobs:
# GH-40558: reduce ASLR to avoid ASAN/LSAN crashes
sudo sysctl -w vm.mmap_rnd_bits=28
source ci/scripts/util_enable_core_dumps.sh
archery docker run ubuntu-cpp-odbc
archery docker run ${{ matrix.run-options || '' }} ${{ matrix.image }}
- name: Upload ODBC ${{ matrix.format }} to the job
if: matrix.build-type == 'release'
uses: actions/upload-artifact@v7
with:
name: flight-sql-odbc-${{ matrix.format }}-installer
path: build/cpp/ArrowFlightSqlOdbc-*.${{ matrix.format }}
if-no-files-found: error
- name: Docker Push
if: >-
success() &&
Expand All @@ -403,7 +419,7 @@ jobs:
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
continue-on-error: true
run: archery docker push ubuntu-cpp-odbc
run: archery docker push ${{ matrix.image }}

odbc-macos:
needs: check-labels
Expand All @@ -428,6 +444,7 @@ jobs:
ARROW_DEPENDENCY_SOURCE: BUNDLED
ARROW_DEPENDENCY_USE_SHARED: OFF
ARROW_FLIGHT_SQL_ODBC: ON
ARROW_FLIGHT_SQL_ODBC_INSTALLER: ON
ARROW_HOME: /tmp/local
ARROW_MIMALLOC: OFF
steps:
Expand Down Expand Up @@ -503,6 +520,19 @@ jobs:
--allow libresolv \
--allow libz \
"$(pwd)/build/cpp/${{ matrix.build-type }}/libarrow_flight_sql_odbc.dylib"
- name: Generate macOS Installer
if: matrix.build-type == 'release'
shell: bash
run: |
cd $(pwd)/build/cpp
cpack
- name: Upload ODBC PKG to the job
if: matrix.build-type == 'release'
uses: actions/upload-artifact@v7
with:
name: flight-sql-odbc-pkg-installer-${{ matrix.architecture }}
path: build/cpp/ArrowFlightSqlOdbc-*.pkg
if-no-files-found: error
- name: Register Flight SQL ODBC Driver
run: |
sudo cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh $(pwd)/build/cpp/${{ matrix.build-type }}/libarrow_flight_sql_odbc.dylib
Expand Down
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ repos:
?^cpp/build-support/update-thrift\.sh$|
?^cpp/examples/minimal_build/run\.sh$|
?^cpp/examples/tutorial_examples/run\.sh$|
?^cpp/src/arrow/flight/sql/odbc/install/mac/postinstall$|
?^cpp/src/arrow/flight/sql/odbc/install/linux/rpm/postinstall$|
?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc\.sh$|
?^cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc_ini\.sh$|
?^dev/release/05-binary-upload\.sh$|
?^dev/release/07-flightsqlodbc-upload\.sh$|
?^dev/release/09-binary-verify\.sh$|
Expand Down
1 change: 1 addition & 0 deletions ci/docker/ubuntu-24.04-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ RUN apt-get update -y -q && \
python3-venv \
rados-objclass-dev \
rapidjson-dev \
rpm \
rsync \
tzdata \
tzdata-legacy \
Expand Down
1 change: 1 addition & 0 deletions ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ else
-Dlz4_SOURCE=${lz4_SOURCE:-} \
-Dnlohmann_json_SOURCE=${nlohmann_json_SOURCE:-} \
-Dopentelemetry-cpp_SOURCE=${opentelemetry_cpp_SOURCE:-} \
-DODBC_PACKAGE_FORMAT=${ODBC_PACKAGE_FORMAT:-} \
-DORC_SOURCE=${ORC_SOURCE:-} \
-DPARQUET_BUILD_EXAMPLES=${PARQUET_BUILD_EXAMPLES:-OFF} \
-DPARQUET_BUILD_EXECUTABLES=${PARQUET_BUILD_EXECUTABLES:-OFF} \
Expand Down
7 changes: 5 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,15 @@ services:
ARROW_PARQUET: "OFF"
ARROW_S3: "OFF"
ARROW_SUBSTRAIT: "OFF"
# Use `/arrow/build` so build artifacts are visible on the CI host
# Generate ODBC installer before testing
# Register ODBC before running tests
command: >
/bin/bash -c "
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
/arrow/ci/scripts/cpp_build.sh /arrow /arrow/build &&
(cd /arrow/build/cpp && cpack) &&
sudo /arrow/cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh /usr/local/lib/libarrow_flight_sql_odbc.so &&
/arrow/ci/scripts/cpp_test.sh /arrow /build"
/arrow/ci/scripts/cpp_test.sh /arrow /arrow/build"

ubuntu-cpp-minimal:
# Arrow build with minimal components/dependencies
Expand Down
6 changes: 6 additions & 0 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ takes precedence over ccache if a storage backend is configured" ON)
ARROW_FLIGHT_SQL
ARROW_COMPUTE)

define_option(ARROW_FLIGHT_SQL_ODBC_INSTALLER
"Build the installer Arrow Flight SQL ODBC extension"
OFF
DEPENDS
ARROW_FLIGHT_SQL_ODBC)

define_option(ARROW_GANDIVA
"Build the Gandiva libraries"
OFF
Expand Down
94 changes: 92 additions & 2 deletions cpp/src/arrow/flight/sql/odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Arrow Flight SQL ODBC Driver")
set(CPACK_PACKAGE_CONTACT "dev@arrow.apache.org")

# GH-47876 TODO: set up `arrow_flight_sql_odbc` component for macOS Installer
# GH-47877 TODO: set up `arrow_flight_sql_odbc` component for Linux Installer
if(WIN32)
# Install ODBC and its Arrow dependencies
Expand All @@ -159,6 +158,85 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)

set(CPACK_WIX_UI_BANNER
"${CMAKE_CURRENT_SOURCE_DIR}/install/windows/arrow-wix-banner.bmp")
else()
set(ODBC_UNIX_FILE_NAME
"ArrowFlightSqlOdbc-${CPACK_PACKAGE_VERSION_MAJOR}.${ODBC_PACKAGE_VERSION_MINOR}.${ODBC_PACKAGE_VERSION_PATCH}"
)
if(APPLE)
set(CPACK_PACKAGE_FILE_NAME "${ODBC_UNIX_FILE_NAME}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")

set(CPACK_SET_DESTDIR ON)
set(CPACK_INSTALL_PREFIX "/Library/ODBC")
# Register ODBC after install
set(CPACK_POSTFLIGHT_ARROW_FLIGHT_SQL_ODBC_SCRIPT
"${CMAKE_CURRENT_SOURCE_DIR}/install/mac/postinstall")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/README.txt")
set(CPACK_RESOURCE_FILE_WELCOME
"${CMAKE_CURRENT_SOURCE_DIR}/install/mac/welcome.txt")

set(ODBC_INSTALL_DIR "arrow-odbc/lib")
set(ODBC_DOC_INSTALL_DIR "arrow-odbc/doc")
else()
# Linux
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
if(${ODBC_PACKAGE_FORMAT} STREQUAL "DEB")
# GH-49595 TODO: implement DEB installer
message(STATUS "ODBC_PACKAGE_FORMAT DEB not implemented, see GH-49595")
elseif(${ODBC_PACKAGE_FORMAT} STREQUAL "RPM")
set(CPACK_RPM_PACKAGE_ARCHITECTURE x86_64)
set(CPACK_GENERATOR RPM)
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/install/linux/postinst")
set(CPACK_RPM_FILE_NAME "${ODBC_UNIX_FILE_NAME}.rpm")
# Disable dependency check as ODBC embeds all third party dependencies
set(CPACK_RPM_PACKAGE_AUTOREQPROV "no")
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
set(CPACK_RPM_COMPONENT_INSTALL ON)
else()
message(FATAL_ERROR "ODBC_PACKAGE_FORMAT '${ODBC_PACKAGE_FORMAT}' must be DEB or RPM for Linux installer."
)
endif()
Comment on lines +180 to +199
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The code changes for RPM installer are ready for review. This PR contains code changes that are dependent on #49766


# By default, Linux installs under /usr
set(ODBC_INSTALL_DIR "lib64/arrow-odbc/lib")
set(ODBC_DOC_INSTALL_DIR "lib64/arrow-odbc/doc")
endif()

# Install ODBC
install(TARGETS arrow_flight_sql_odbc_shared
DESTINATION "${ODBC_INSTALL_DIR}"
COMPONENT arrow_flight_sql_odbc)

# Install temporary driver registration scripts, they will be removed after driver registration is complete
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/install/unix/install_odbc.sh"
DESTINATION "${ODBC_INSTALL_DIR}"
COMPONENT arrow_flight_sql_odbc
PERMISSIONS OWNER_EXECUTE
OWNER_WRITE
OWNER_READ
GROUP_EXECUTE
GROUP_READ
WORLD_EXECUTE
WORLD_READ)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/install/unix/install_odbc_ini.sh"
DESTINATION "${ODBC_INSTALL_DIR}"
COMPONENT arrow_flight_sql_odbc
PERMISSIONS OWNER_EXECUTE
OWNER_WRITE
OWNER_READ
GROUP_EXECUTE
GROUP_READ
WORLD_EXECUTE
WORLD_READ)

# Install documentation files
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../LICENSE.txt"
DESTINATION "${ODBC_DOC_INSTALL_DIR}"
COMPONENT Docs)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/connection-options.md"
DESTINATION "${ODBC_DOC_INSTALL_DIR}"
COMPONENT Docs)
endif()

get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
Expand All @@ -173,8 +251,13 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
# Upgrade GUID is required to be unchanged for ODBC installer to upgrade
set(CPACK_WIX_UPGRADE_GUID "DBF27A18-F8BF-423F-9E3A-957414D52C4B")
set(CPACK_WIX_PRODUCT_GUID "279D087B-93B5-4DC3-BA69-BCF485022A26")
else()
# macOS and Linux
list(APPEND CPACK_COMPONENTS_ALL Docs)
if(APPLE)
set(CPACK_GENERATOR "productbuild")
endif()
endif()
# GH-47876 TODO: create macOS Installer using cpack
# GH-47877 TODO: create Linux Installer using cpack

# Load CPack after all CPACK* variables are set
Expand All @@ -183,4 +266,11 @@ if(ARROW_FLIGHT_SQL_ODBC_INSTALLER)
DISPLAY_NAME "ODBC library"
DESCRIPTION "Apache Arrow Flight SQL ODBC library bin, required to install"
REQUIRED)
if(UNIX)
# On macOS and Linux, provide connection string documentation since users need to manually enter DSN keys.
cpack_add_component(Docs
DISPLAY_NAME "Documentation"
DESCRIPTION "Documentation for Apache Arrow Flight SQL ODBC Driver"
)
endif()
endif()
16 changes: 16 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ After ODBC has been registered, you can run the ODBC tests. It is recommended to
.\cpp\build\< release | debug >\< Release | Debug>\arrow-flight-sql-odbc-test.exe
```

## Installers

ODBC installers are uploaded to the CI artifacts.

| Operating System | Package Format |
|------------------|----------------|
| Windows | MSI |
| macOS | PKG |
| Linux | DEB / RPM |

### Install `.RPM` on Ubuntu
While installing via `.DEB` installer on Ubuntu is the recommended approach, users may install `.RPM` on Ubuntu using below command
```
alien -i --scripts ArrowFlightSqlOdbc-<version>.rpm
```

## Known Limitations

- Conversion from timestamp data type with specified time zone value to strings is not supported at the moment. This doesn't impact driver's usage of retrieving timestamp data from Power BI on Windows, and Excel on macOS and Windows. See GH-47504 for more context.
Expand Down
20 changes: 20 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/connection-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!---
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.
-->

GH-49723 TODO: enter ODBC connection options for unix DSN
30 changes: 30 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/install/linux/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#
# 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.

# Use temporary driver registration script to register ODBC driver in system DSN
odbc_install_script="/usr/lib64/arrow-odbc/lib/install_odbc.sh"
"$odbc_install_script" /usr/lib64/arrow-odbc/lib/libarrow_flight_sql_odbc.so

# Use temporary DSN registration script to register sample system DSN
dsn_install_script="/usr/lib64/arrow-odbc/lib/install_odbc_ini.sh"
"$dsn_install_script" /etc/odbc.ini

# clean temporary script
rm -f "$odbc_install_script"
rm -f "$dsn_install_script"
9 changes: 9 additions & 0 deletions cpp/src/arrow/flight/sql/odbc/install/mac/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Files are available in '/Library/ODBC/arrow-odbc' after installation.

To set up a connection, you can use DSN to store your data source connection information.
1. Open 'iODBC Data Source Administrator'.
2. To create a user DSN, go to 'User DSN' tab and click 'Add'.
3. Select 'Apache Arrow Flight SQL ODBC Driver' and click 'Finish'.
4. Enter DSN name and connection string values.
For the list of all supported options, check '/Library/ODBC/arrow-odbc/doc/Connection-Options.md'.
5. Click 'OK' to save the DSN.
Loading
Loading