This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Blaze-Query is a multi-platform querying library that lets you run SQL queries against cloud infrastructure and SaaS platform APIs. It uses Apache Calcite for SQL parsing/optimization and fetches data from cloud providers via a connector pattern. Data is cached in-memory within a QuerySession.
# Build and run all tests
./gradlew check -Plog-test-progress=true --stacktrace
# Run tests for a single module
./gradlew :blaze-query-connector-aws-ec2:check
# Format check (CI uses this)
./gradlew spotlessCheck
# Apply formatting (runs automatically before compile)
./gradlew spotlessApplyJava 17 is required. The build uses Gradle with parallel execution enabled.
- Tab indentation (4-space width)
- All source files must have the SPDX Apache 2.0 license header (managed by Spotless)
- Spotless runs automatically before compilation (
compileJava.dependsOn spotlessApply) - Unused imports are removed automatically
core/api— Public interfaces:QueryContext,QuerySession,TypedQuery,Metamodelcore/apiSPI (com.blazebit.query.spi) —DataFetcher<T>,DataFormat,QuerySchemaProvider,DataFetcherConfig<T>core/impl— Query engine implementation using Apache Calcite. Parses SQL, builds execution plans, calls DataFetchers, converts types, returns results.
Entry point: Queries.createQueryContextBuilder().loadServices().build() creates a QueryContext. From there, createSession() gives a QuerySession (not thread-safe) that caches fetched data and executes queries.
Each connector module follows this structure:
- Schema objects — POJOs/wrappers around cloud SDK types (e.g.,
GcpInstancewrapscom.google.cloud.compute.v1.Instance) - DataFetcher implementation — Implements
DataFetcher<T>, calls cloud SDK to fetch data, returns wrapped objects. Defines itsDataFormatusingDataFormatsutility from connector-base with conventions likebeansConvention()orfieldsConvention(). - QuerySchemaProvider — Implements
QuerySchemaProvider, registered viaMETA-INF/services/com.blazebit.query.spi.QuerySchemaProvider. Returns the set of DataFetcher instances for the module. - ConventionContext (optional) — Filters which fields from cloud SDK types are exposed as queryable columns.
Provides DataFormats utility for introspecting Java types into DataFormat definitions, and ConventionContext for filtering fields. All connectors depend on this.
blaze-query-connector-{platform}-{service}
blaze-query-connector-{platform}-{service}-{variant} # e.g., -jersey3
Gradle project names use colons: :blaze-query-connector-aws-ec2
- AWS (
connector/aws/) — EC2, ECS, EKS, Lambda, RDS, S3, IAM, KMS, CloudWatch, CloudTrail, SNS, etc. Usesconnector/aws/basefor shared AWS config. - Azure (
connector/azure/) — Resource Manager, Microsoft Graph - Google Cloud (
connector/google/gcp/) — Compute, IAM, Storage. Usesconnector/google/gcp/basefor shared GCP config. - Google Workspace (
connector/google/workspace/) — Directory, Drive - GitHub (
connector/github*/) — REST (OpenAPI-generated) and GraphQL - GitLab (
connector/gitlab/) - Jira (
connector/jira/) — Cloud and DataCenter variants with Jersey3 alternatives - Kandji (
connector/kandji/)
- Create module directory under
connector/{platform}/{service}/ - Add to
settings.gradlewith include and projectDir mapping - Implement
DataFetcher<T>withgetDataFormat()andfetch() - Implement
QuerySchemaProviderreturning your fetcher(s) - Register via
META-INF/services/com.blazebit.query.spi.QuerySchemaProvider - Use
DataFormats.beansConvention()orfieldsConvention()for DataFormat definition - Optionally implement
ConventionContextto filter out non-queryable fields