-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature Request
Add support for LIKE and EXCEPT patterns in DUMP TABLES statement to allow flexible table filtering, with future extension to named schemas.
Current State
DUMP TABLES currently accepts a comma-separated list of exact table names:
DUMP TABLES table1, table2, table3Proposed Enhancement
Support pattern matching for table selection:
-- Export all tables matching a pattern
DUMP TABLES LIKE 'User%'
-- Export all tables except those matching a pattern
DUMP TABLES EXCEPT 'Test%', 'Tmp%'
-- Combine LIKE and EXCEPT
DUMP TABLES LIKE 'User%' EXCEPT 'UserTest%'Future Extension: Named Schema Support
When named schemas are supported in Cloud Spanner, this can be naturally extended:
-- Export tables from specific schemas
DUMP TABLES FROM SCHEMA 'public' LIKE 'User%'
DUMP TABLES FROM SCHEMA 'analytics' EXCEPT 'Tmp%'
-- Or with schema patterns
DUMP TABLES LIKE '%.User%' -- All User tables in any schema
DUMP TABLES LIKE 'public.%' -- All tables in public schemaImplementation Approach
The filtering can be implemented by adding WHERE conditions to the INFORMATION_SCHEMA.TABLES query:
-- Current: For table name patterns
WHERE TABLE_NAME LIKE 'User%'
WHERE TABLE_NAME NOT LIKE 'Test%'
-- Future: For schema + table patterns
WHERE TABLE_SCHEMA LIKE 'public' AND TABLE_NAME LIKE 'User%'
WHERE CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) LIKE 'public.User%'This approach:
- Leverages existing SQL pattern matching capabilities
- Works naturally with the existing dependency ordering logic
- Easily extensible when named schemas become available
- No need for client-side pattern matching implementation
- Consistent with SQL conventions
Use Cases
- Development/Production separation: Export all tables except test data
- Module-specific exports: Export only tables for a specific feature
- Schema-based exports (future): Export entire schemas or cross-schema patterns
- Multi-tenant scenarios (future): Export data for specific tenants using schema patterns
Related
- PR feat: implement DUMP statements for database export #434 - Initial DUMP implementation
- Issue Add PostgreSQL dialect support for DUMP statements #435 - PostgreSQL dialect support
- Issue Implement table dependency resolver for INTERLEAVE and FK relationships #426 - Foreign key support
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request