This file provides context and guidelines for AI assistants working with the DNAstack Data Connect Trino repository.
Data Connect Trino is an implementation of the GA4GH Discovery Data Connect API on top of Trino (formerly PrestoSQL). This service enables users to enumerate and query data surfaced by a Trino instance in a manner compliant with GA4GH Discovery specifications, returning responses in the Table specification format.
- Language: Java 21
- Framework: Spring Boot 3.4.x
- Database: PostgreSQL (for query storage) + Trino (for data queries)
- Build Tool: Maven
- Authentication: JWT, Basic Auth, or No-Auth profiles
- API Specification: GA4GH Discovery Data Connect API
- Testing: JUnit 5, Spring Boot Test
- Containerization: Docker with multi-stage builds
data-connect-trino/
├── src/main/java/com/dnastack/ga4gh/dataconnect/
│ ├── adapter/
│ │ ├── security/ # Authentication and authorization
│ │ ├── shared/ # Shared utilities and exceptions
│ │ ├── telemetry/ # Telemetry and monitoring
│ │ └── trino/ # Trino-specific adapters and transformers
│ ├── client/ # External service clients
│ │ ├── collectionservice/
│ │ ├── indexingservice/
│ │ └── tablesregistry/
│ ├── controller/ # REST endpoints
│ ├── model/ # Data models
│ └── repository/ # Database repositories
├── e2e-tests/ # End-to-end tests
├── ci/ # CI/CD scripts and Docker configurations
└── helm/ # Kubernetes Helm charts
- Trino Setup: Ensure you have access to a Trino server
- Database Setup: PostgreSQL must be running with a
dataconnecttrinodatabase - Environment Variables: Configure Trino URL and authentication
- Run Command:
mvn clean spring-boot:run
The service supports three authentication profiles:
- default (JWT): Requires JWT tokens with configurable validation
- wallet-auth: DNAstack Wallet-based authentication with policy evaluation
- no-auth: No authentication (development only)
- basic-auth: Basic HTTP authentication
- Follow DNAstack Java coding standards
- Use Spring Boot conventions for dependency injection
- Implement proper error handling with meaningful error messages
- Document all public APIs with JavaDoc
- Write comprehensive unit and integration tests
- Use the Trino client for query execution
- Transform Trino schemas to Data Connect format
- Handle Trino-specific errors gracefully
- Support pagination for large result sets
- Implement query cleanup for resource management
- PostgreSQL is used to store queries for pagination support
- Use Liquibase for schema migrations
- Implement proper connection pooling
- Handle database errors appropriately
- Implement GA4GH Discovery Data Connect specification
- Support table enumeration and querying
- Return responses in Table specification format
- Handle CORS appropriately
- Implement proper pagination
- Map Trino errors to appropriate HTTP status codes
- Provide user-friendly error messages
- Log detailed error information for debugging
- Handle authentication/authorization errors
- Test business logic in isolation
- Mock external dependencies (Trino, PostgreSQL)
- Test error scenarios
- Verify data transformations
- Test Spring Boot configuration
- Verify security configurations
- Test database interactions
- Validate API contracts
- Test complete API workflows
- Verify Trino query execution
- Test pagination functionality
- Validate authentication flows
# Trino configuration
trino.datasource.url: URL of Trino server
# Database configuration
spring.datasource.*: PostgreSQL connection settings
# Authentication configuration
app.auth.*: Authentication and authorization settings
# Service registry configuration
app.tables-registry.*: Tables registry client settingsTRINO_DATASOURCE_URL: Trino server URLSPRING_PROFILES_ACTIVE: Active Spring profileAPP_AUTH_*: Authentication configuration- Database connection variables
- Update Trino query builder
- Implement data transformation logic
- Add appropriate error handling
- Write unit tests
- Update API documentation
- Update security configuration
- Modify access evaluator if needed
- Test with different auth profiles
- Update deployment documentation
- Configure Trino catalog/schema
- Update data model mappings
- Test query functionality
- Document new capabilities
- Trino Connection: Verify Trino URL and network connectivity
- Authentication Failures: Check JWT configuration and token validity
- Query Errors: Review Trino query syntax and permissions
- Pagination Issues: Ensure PostgreSQL is accessible and queries are stored
- Enable debug logging for Trino client
- Check Spring Boot actuator endpoints
- Review Trino query history
- Monitor PostgreSQL query storage
- Implement query result caching where appropriate
- Use connection pooling for database connections
- Monitor Trino query performance
- Implement appropriate timeouts
- Consider result set size limitations
- Validate all input parameters
- Use parameterized queries to prevent SQL injection
- Implement proper authentication and authorization
- Audit sensitive operations
- Follow principle of least privilege for service accounts