### Install and Load Extension in DuckDB Source: https://github.com/duckdb/ducklake/blob/main/docs/NEXT_README.md Use the SQL commands INSTALL and LOAD to install and load an extension after configuring the repository and enabling unsigned extensions. ```sql INSTALL quack LOAD quack ``` -------------------------------- ### Start Minio Server Source: https://github.com/duckdb/ducklake/blob/main/examples/minio-demo-server/README.md Starts a local Minio S3 server. This command creates a directory for Minio data and starts the server. Note the HTTP endpoint, port, and credentials provided upon startup. ```bash mkdir -p path/to/some_folder minio server path/to/some_folder ``` -------------------------------- ### Basic CMake Setup Source: https://github.com/duckdb/ducklake/blob/main/CMakeLists.txt Sets the minimum CMake version and defines the target extension name. ```cmake cmake_minimum_required(VERSION 3.5) # Set extension name here set(TARGET_NAME ducklake) set(EXTENSION_NAME ${TARGET_NAME}_extension) set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension) project(${TARGET_NAME}) ``` -------------------------------- ### Install Minio and mc Tools Source: https://github.com/duckdb/ducklake/blob/main/examples/minio-demo-server/README.md Installs the Minio server and Minio client (mc) using Homebrew. These tools are required for setting up a local S3-compatible storage. ```bash brew install minio/stable/minio brew install minio/stable/mc ``` -------------------------------- ### Installing Extension Target Source: https://github.com/duckdb/ducklake/blob/main/CMakeLists.txt Installs the static extension target to the appropriate library directory. ```cmake install( TARGETS ${EXTENSION_NAME} EXPORT "${DUCKDB_EXPORT_SET}" LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ARCHIVE DESTINATION "${INSTALL_LIB_DIR}") ``` -------------------------------- ### Install DuckDB CLI Source: https://github.com/duckdb/ducklake/blob/main/examples/minio-demo-server/README.md Installs the DuckDB command-line interface using Homebrew. ```bash brew install duckdb ``` -------------------------------- ### Install Latest Development Version Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Installs the latest development version of the DuckLake extension from the 'core_nightly' channel. Use FORCE INSTALL to overwrite any existing installation. ```sql FORCE INSTALL ducklake FROM core_nightly; ``` -------------------------------- ### Install DuckLake Extension Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Installs the DuckLake extension using the SQL INSTALL command. This is the standard method for adding the extension to your DuckDB environment. ```sql INSTALL ducklake; ``` -------------------------------- ### Basic DuckLake Usage Example Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Demonstrates attaching a DuckLake database, creating a table, inserting data, and querying it. The metadata is stored in 'metadata.ducklake' and data in 'file_path/'. ```sql ATTACH 'ducklake:metadata.ducklake' AS my_ducklake (DATA_PATH 'file_path/'); USE my_ducklake; CREATE TABLE my_ducklake.my_table(id INTEGER, val VARCHAR); INSERT INTO my_ducklake.my_table VALUES (1, 'Hello'), (2, 'World'); FROM my_ducklake.my_table; ``` -------------------------------- ### Check Tool Versions Source: https://github.com/duckdb/ducklake/blob/main/examples/minio-demo-server/README.md Verifies the installed versions of DuckDB, Minio server, and Minio client (mc). ```bash $ duckdb --version v1.3.0 71c5c07cdd $ minio -version minio version RELEASE.2025-04-22T22-12-26Z (commit-id=0d7408fc9969caf07de6a8c3a84f9fbb10a6739e) Runtime: go1.24.2 darwin/arm64 License: GNU AGPLv3 - https://www.gnu.org/licenses/agpl-3.0.html Copyright: 2015-2025 MinIO, Inc. $ mc --version mc version RELEASE.2025-04-16T18-13-26Z (commit-id=b00526b153a31b36767991a4f5ce2cced435ee8e) Runtime: go1.24.2 darwin/arm64 Copyright (c) 2015-2025 MinIO, Inc. License GNU AGPLv3 ``` -------------------------------- ### Run the Quack Extension in DuckDB Shell Source: https://github.com/duckdb/ducklake/blob/main/docs/NEXT_README.md Start the DuckDB shell with the extension automatically loaded and use the scalar function 'quack()'. ```sql D select quack('Jane') as result; ``` -------------------------------- ### Include Directory Management Source: https://github.com/duckdb/ducklake/blob/main/CMakeLists.txt Includes project-specific headers and Roaring library headers. Handles cases where Roaring might be installed differently. ```cmake include_directories(src/include) # Roaring is installed via vcpkg and used for deletion vectors find_package(roaring CONFIG REQUIRED) if(TARGET roaring::roaring-headers) get_target_property(ROARING_INCLUDE_DIRS roaring::roaring-headers INTERFACE_INCLUDE_DIRECTORIES) else() get_target_property(ROARING_INCLUDE_DIRS roaring::roaring INTERFACE_INCLUDE_DIRECTORIES) endif() if(NOT ROARING_INCLUDE_DIRS OR ROARING_INCLUDE_DIRS STREQUAL "ROARING_INCLUDE_DIRS-NOTFOUND") set(ROARING_INCLUDE_DIRS "${roaring_DIR}/../../include") endif() include_directories(${ROARING_INCLUDE_DIRS}) ``` -------------------------------- ### Set Custom Extension Repository Source: https://github.com/duckdb/ducklake/blob/main/docs/NEXT_README.md Configure DuckDB to use a custom repository for installing extensions by setting the 'custom_extension_repository' SQL variable. ```sql SET custom_extension_repository='bucket.s3.eu-west-1.amazonaws.com//latest'; ``` -------------------------------- ### Run DuckDB Shell with DuckLake Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Executes the bundled DuckDB shell after building the extension. This command starts an interactive DuckDB session with the DuckLake extension available. ```bash ./build/release/duckdb ``` -------------------------------- ### Run DuckLake Tests with SQLite Catalog Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Executes DuckLake tests using SQLite as the catalog database. This is a simpler setup compared to PostgreSQL and uses a dedicated test configuration. ```bash ./build/release/test/unittest --test-config test/configs/sqlite.json ``` -------------------------------- ### Configure Minio Client and Create Bucket Source: https://github.com/duckdb/ducklake/blob/main/examples/minio-demo-server/README.md Sets up an alias for the local Minio server using the 'mc' client and creates a new S3 bucket named 'demo-ducklake-minio-bucket'. Ensure the endpoint, access key, and secret key match your Minio server configuration. ```bash mc alias set 'myminio' 'http://10.1.0.202:9000' 'minioadmin' 'minioadmin' mc mb myminio/demo-ducklake-minio-bucket ``` -------------------------------- ### Clone and Bootstrap VCPKG Source: https://github.com/duckdb/ducklake/blob/main/docs/NEXT_README.md Clone the VCPKG repository and bootstrap it. This is required for extensions that use VCPKG for dependency management. ```shell git clone https://github.com/Microsoft/vcpkg.git ./vcpkg/bootstrap-vcpkg.sh export VCPKG_TOOLCHAIN_PATH=`pwd`/vcpkg/scripts/buildsystems/vcpkg.cmake ``` -------------------------------- ### Building Extension Targets Source: https://github.com/duckdb/ducklake/blob/main/CMakeLists.txt Builds both static and loadable versions of the extension using provided source files. ```cmake add_subdirectory(src) set(EXTENSION_SOURCES ${ALL_OBJECT_FILES}) build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES}) build_loadable_extension(${TARGET_NAME} " " ${EXTENSION_SOURCES}) ``` -------------------------------- ### Build the Quack Extension Source: https://github.com/duckdb/ducklake/blob/main/docs/NEXT_README.md Build the extension using the make command. This generates the duckdb shell, unittest binary, and the loadable extension file. ```shell make ``` -------------------------------- ### Run SQLLogicTests Source: https://github.com/duckdb/ducklake/blob/main/test/README.md Execute all SQLLogicTests for the extension. This command builds and runs the tests. ```bash make test ``` -------------------------------- ### DuckDB SQL for Minio Integration Source: https://github.com/duckdb/ducklake/blob/main/examples/minio-demo-server/README.md SQL commands to configure DuckDB to connect to the local Minio S3 bucket, attach a DuckLake database, create a table, and manage data. ```sql --- Setup relevant DuckDB temporary secret to gain access to the local MinIO S3 bucket create secret (type s3, key_id 'minioadmin', secret 'minioadmin', endpoint '10.1.0.202:9000', use_ssl false, url_style 'path'); --- Attach a local DuckDB file (minio-ducklake-demo.ducklake) and a local (but using S3 protocol) bucket ATTACH 'ducklake:minio-ducklake-demo.ducklake' as db (DATA_PATH 's3://demo-ducklake-minio-bucket'); --- Use the just attached DuckLake as default Database USE db; --- Create a table with some data (in the ducklake) CREATE TABLE numbers AS (SELECT random() FROM range(100000)); --- Check which files are in the bucket FROM glob('s3://demo-ducklake-minio-bucket/**'); --- This will show both minio-ducklake-demo.ducklake (and it's WAL file) and the minio relevant files, just to check it's actually local data FROM glob('**'); --- Remove some data DELETE FROM numbers WHERE #1 < 0.1; --- Check which files are in the bucket, now there should also be a delete file FROM glob('s3://demo-ducklake-minio-bucket/**'); --- Now you have a fully local DuckLake, backed by a local DuckDB Database and a local S3-bucket (via Minio) ``` -------------------------------- ### Build DuckLake Extension Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Commands to initialize and update git submodules, pull dependencies, and build the DuckLake extension. Use 'make GEN=ninja release' for multi-core builds. ```bash git submodule init git submodule update # to build with multiple cores, use `make GEN=ninja release` make pull make ``` -------------------------------- ### Enable Unsigned Extensions in DuckDB CLI Source: https://github.com/duckdb/ducklake/blob/main/docs/NEXT_README.md Launch the DuckDB CLI with the '-unsigned' flag to allow unsigned extensions. ```shell duckdb -unsigned ``` -------------------------------- ### C++ Standard Configuration Source: https://github.com/duckdb/ducklake/blob/main/CMakeLists.txt Specifies C++17 as the required standard for the project. ```cmake set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) ``` -------------------------------- ### Enable Unsigned Extensions in DuckDB NodeJS Source: https://github.com/duckdb/ducklake/blob/main/docs/NEXT_README.md Initialize a DuckDB database in NodeJS with the 'allow_unsigned_extensions' option set to true. ```javascript db = new duckdb.Database(':memory:', {"allow_unsigned_extensions": "true"}); ``` -------------------------------- ### Run DuckDB Core Tests with DuckLake Backend Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Executes DuckDB core tests using DuckLake as the storage backend. This requires a specific test configuration file that enables DuckLake attachment. ```bash ./build/release/test/unittest --test-config test/configs/attach_ducklake.json --test-dir duckdb ``` -------------------------------- ### Enable Unsigned Extensions in DuckDB Python Source: https://github.com/duckdb/ducklake/blob/main/docs/NEXT_README.md Connect to DuckDB in Python with the 'allow_unsigned_extensions' configuration set to 'true'. ```python con = duckdb.connect(':memory:', config={'allow_unsigned_extensions' : 'true'}) ``` -------------------------------- ### Run Unit Tests with Deletion Vectors Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Execute the DuckDB unit test suite with the deletion vectors configuration enabled. This command is used to verify the functionality and performance of deletion vectors. ```bash ./build/release/test/unittest --test-config test/configs/deletion_vectors.json ``` -------------------------------- ### Run All DuckLake Extension Tests Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Executes all unit tests for the DuckLake extension. This is a comprehensive test suite to ensure the extension's functionality. ```bash ./build/release/test/unittest ``` -------------------------------- ### Run SQLLogicTests in Debug Mode Source: https://github.com/duckdb/ducklake/blob/main/test/README.md Execute all SQLLogicTests for the extension in debug mode. This is useful for troubleshooting test failures. ```bash make test_debug ``` -------------------------------- ### Linking Roaring Libraries Source: https://github.com/duckdb/ducklake/blob/main/CMakeLists.txt Links the necessary Roaring libraries to the extension targets, handling different configurations. ```cmake if(TARGET roaring::roaring-headers) target_link_libraries(${EXTENSION_NAME} roaring::roaring roaring::roaring-headers roaring::roaring-headers-cpp) target_link_libraries(${TARGET_NAME}_loadable_extension roaring::roaring roaring::roaring-headers roaring::roaring-headers-cpp) else() target_link_libraries(${EXTENSION_NAME} roaring::roaring) target_link_libraries(${TARGET_NAME}_loadable_extension roaring::roaring) endif() ``` -------------------------------- ### Run DuckLake Tests with PostgreSQL Catalog Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Executes DuckLake tests where PostgreSQL is used as the catalog database. This requires a running PostgreSQL instance and a specific test configuration. ```bash ./build/release/test/unittest --test-config test/configs/postgres.json ``` -------------------------------- ### Add Ducklake Statistics Library Source: https://github.com/duckdb/ducklake/blob/main/src/storage/statistics/CMakeLists.txt Adds the ducklake_statistics library as an OBJECT library, compiling source files into object files. ```cmake add_library(ducklake_statistics OBJECT ducklake_geo_stats.cpp ducklake_variant_stats.cpp) ``` -------------------------------- ### Run DuckLake Tests Matching a Pattern Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Executes DuckLake extension tests that match a given pattern. This is useful for running a subset of tests, such as all tests in a specific directory. ```bash ./build/release/test/unittest "test/sql/partitioning/*" ``` -------------------------------- ### Schema Evolution in DuckLake Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Illustrates adding a new column ('new_column' of type VARCHAR) to an existing DuckLake table. Existing rows will have NULL values for the new column. ```sql ALTER TABLE my_ducklake.my_table ADD COLUMN new_column VARCHAR; FROM my_ducklake.my_table; ``` -------------------------------- ### Time Travel Query in DuckLake Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Demonstrates querying a DuckLake table at a specific historical version (VERSION => 2). This allows retrieving data as it existed at that point in time. ```sql FROM my_ducklake.my_table AT (VERSION => 2); ``` -------------------------------- ### Set All Object Files Source: https://github.com/duckdb/ducklake/blob/main/src/storage/statistics/CMakeLists.txt Appends the object files from the ducklake_statistics library to the global ALL_OBJECT_FILES variable, making them available in the parent scope. ```cmake set(ALL_OBJECT_FILES ${ALL_OBJECT_FILES} $ PARENT_SCOPE) ``` -------------------------------- ### Run Specific DuckLake Test File Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Executes a single test file within the DuckLake extension's test suite. Specify the path to the test file you want to run. ```bash ./build/release/test/unittest test/sql/transaction/create_conflict.test ``` -------------------------------- ### Define DuckDB Metadata Manager Object Library Source: https://github.com/duckdb/ducklake/blob/main/src/metadata_manager/CMakeLists.txt Defines the 'ducklake_metadata_manager' as an OBJECT library, compiling its source files. This allows its object files to be linked into other targets without creating a separate static or shared library. ```cmake add_library( ducklake_metadata_manager OBJECT ducklake_metadata_manager_v1_1.cpp postgres_metadata_manager.cpp sqlite_metadata_manager.cpp) ``` -------------------------------- ### Compiler Warning Configuration Source: https://github.com/duckdb/ducklake/blob/main/CMakeLists.txt Adds a specific warning flag for Clang to detect potential issues with returning unique_ptr. ```cmake # Warn when returning unique_ptr as unique_ptr without std::move # (Clang-specific; GCC does not need an explicit flag for this pattern) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wreturn-std-move) endif() ``` -------------------------------- ### Manage Global Object Files in CMake Source: https://github.com/duckdb/ducklake/blob/main/src/metadata_manager/CMakeLists.txt Appends the object files from the 'ducklake_metadata_manager' target to a global list named 'ALL_OBJECT_FILES'. This makes the compiled object files available for use by other CMake targets within the project. ```cmake set(ALL_OBJECT_FILES ${ALL_OBJECT_FILES} $ PARENT_SCOPE) ``` -------------------------------- ### Add ducklake_common Library Source: https://github.com/duckdb/ducklake/blob/main/src/common/CMakeLists.txt Defines the ducklake_common library as an OBJECT library and lists its source files. This is used to compile common utility code for the ducklake module. ```cmake add_library( ducklake_common OBJECT ducklake_data_file.cpp ducklake_name_map.cpp ducklake_snapshot.cpp ducklake_types.cpp ducklake_util.cpp ducklake_version.cpp parquet_file_scanner.cpp) ``` -------------------------------- ### Collect Object Files Source: https://github.com/duckdb/ducklake/blob/main/src/common/CMakeLists.txt Appends the object files from the ducklake_common library to a global list of all object files. This ensures that the compiled code is available for linking into other targets. ```cmake set(ALL_OBJECT_FILES ${ALL_OBJECT_FILES} $ PARENT_SCOPE) ``` -------------------------------- ### Change Data Feed Query Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Retrieves change data for a specific table ('my_table') between two snapshot IDs (2 and 2). This shows inserts that occurred within that range. ```sql FROM my_ducklake.table_changes('my_table', 2, 2); ``` -------------------------------- ### Define Ducklake Functions Library Source: https://github.com/duckdb/ducklake/blob/main/src/functions/CMakeLists.txt This snippet defines a CMake library target named 'ducklake_functions' of type OBJECT. It lists all the C++ source files that constitute the library's implementation. ```cmake add_library( ducklake_functions OBJECT base_metadata_function.cpp ducklake_add_data_files.cpp ducklake_cleanup_files.cpp ducklake_expire_snapshots.cpp ducklake_flush_inlined_data.cpp ducklake_current_snapshot.cpp ducklake_last_committed_snapshot.cpp ducklake_list_files.cpp ducklake_compaction_functions.cpp ducklake_set_commit_message.cpp ducklake_set_option.cpp ducklake_snapshots.cpp ducklake_options.cpp ducklake_settings.cpp ducklake_table_changes.cpp ducklake_table_info.cpp ducklake_table_insertions.cpp ducklake_murmur3.cpp) set(ALL_OBJECT_FILES ${ALL_OBJECT_FILES} $ PARENT_SCOPE) ``` -------------------------------- ### Update Data in DuckLake Table Source: https://github.com/duckdb/ducklake/blob/main/docs/README.md Shows how to update existing records in a DuckLake table. This operation modifies the 'val' column for the row where 'id' is 2. ```sql UPDATE my_ducklake.my_table SET val='DuckLake' WHERE id=2; FROM my_ducklake.my_table; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.