Repository navigation
Description
Feature Request: Support DuckDB Virtual File System for Configuration and SQL Files
Is your feature request related to a problem? Please describe.
Currently, flapi reads configuration files, endpoint definitions, and SQL files exclusively from the local file system. This limits deployment flexibility in cloud-native and containerized environments where:
- Configuration should be centralized (e.g., in S3, GCS, or Azure Blob Storage)
- SQL templates might be managed in a shared repository accessible via HTTP(S)
- Teams want to update endpoint definitions without redeploying containers
- Multi-instance deployments need consistent configuration without shared volumes
The current local-filesystem-only approach creates operational friction when deploying flapi in modern infrastructure where "cattle, not pets" principles apply.
Describe the solution you'd like
I propose leveraging DuckDB's Virtual File System (VFS) abstraction to handle all file operations for configuration, endpoint definitions, and SQL files.
DuckDB already supports multiple file system backends out of the box:
- S3 (
s3://bucket/path/config.yaml) - GCS (
gs://bucket/path/endpoints/) - Azure Blob (
azure://container/path/) - HTTP(S) (
https://config-server.example.com/flapi/endpoints/) - Local (current behavior, remains default)
Proposed Changes:
- Abstract all file read operations (and writes where supported) through DuckDB's
FileSysteminterface - Support URI-style paths in the
--config-path/--endpoints-pathCLI arguments and configuration - Add optional credentials configuration for cloud storage (or inherit from environment variables / instance profiles)
- Implement appropriate caching strategies for remote files (with configurable TTL for hot-reload scenarios)
Configuration Example:
# flapi.yaml
endpoints_path: "s3://my-company-configs/flapi/endpoints/"
sql_path: "s3://my-company-configs/flapi/sql/"
templates_path: "https://raw.githubusercontent.com/myorg/flapi-templates/main/"Describe alternatives you've considered
- Mounted Volumes (EFS, NFS): Works but adds infrastructure complexity, latency, and cost; doesn't leverage DuckDB's existing capabilities.
- Init Containers / Sync Scripts: Copying files at startup works but loses the ability to hot-reload configuration changes.
- Environment Variables / ConfigMaps: Suitable for small configs but impractical for managing multiple endpoint definitions and SQL templates.
Additional Context & Use Cases
-
Centralized Configuration Management:
DevOps teams can manage allflapiconfigurations in a single S3 bucket with versioning, avoiding configuration drift across instances:flapi --config s3://company-configs/flapi/production/
-
GitOps Workflows:
SQL templates and endpoint definitions can be served directly from a Git repository via raw HTTP URLs, enabling true GitOps:sql_path: "https://raw.githubusercontent.com/myorg/analytics-sql/main/queries/"
-
Multi-Tenant / Multi-Environment Deployments:
Different environments or tenants can point to different configuration paths without requiring separate container images or complex volume mounts. -
Serverless / Ephemeral Deployments:
Functions-as-a-Service or short-lived containers can bootstrap configuration from remote storage without persistent local state.
Technical Feasibility
DuckDB's FileSystem abstraction is already mature and battle-tested. The httpfs extension (bundled) provides S3, GCS, Azure, and HTTP support. Since flapi already depends on DuckDB, this is primarily a matter of routing file operations through the existing DuckDB APIs rather than direct std::ifstream / POSIX calls. Write support would be limited to backends that support it (S3, local) while HTTP would be read-only—which aligns with typical configuration patterns.
Activity
[-]Support DuckDB Virtual File System for Configuration and SQL Files[/-][+]Feature Request: Support DuckDB Virtual File System for Configuration and SQL Files[/+]feat: Add IFileProvider interface and LocalFileProvider for VFS abstr…
feat: Add DuckDBVFSProvider for remote file access via DuckDB VFS (#10)
feat: Integrate VFSAdapter into ConfigLoader for remote config support (
feat: Integrate VFSAdapter into SQLTemplateProcessor for remote templ…
feat: Add PathValidator for security-focused path validation (#10)
test: Add VFS end-to-end integration tests (#10)
docs: Add cloud storage guide and example configurations (#10)
test: Fix macOS path canonicalization in tests (#10)
fix: Address security issues from Codex code review (#10)
chore(beads): Close security bug tickets from VFS code review
fix: Handle macOS platform-specific build paths in tests (#10)
Merge pull request #12 from DataZooDE/feature/gh-10-vfs-abstraction
Merge branch 'main' into feature/gh-10-vfs-cloud-support
Merge pull request #15 from DataZooDE/feature/gh-10-vfs-cloud-support
refactor(mcp): protocol hygiene + dead-code purge