-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Feature Request
Extend URI loading functionality to other commands that load files, such as the \. meta command.
Background
In #470, we implemented URI-based loading functionality that supports multiple schemes:
gs://- Google Cloud Storagefile://- Local file systemhttp:///https://- HTTP(S) downloads
This functionality is currently only used for --sample-database flag, but could be valuable for other file-loading operations.
Proposed Enhancement
1. Extend \. Meta Command
The \. command (LOAD) currently only supports local file paths. It could benefit from URI support:
-- Load from Google Cloud Storage
\. gs://my-bucket/scripts/setup.sql
-- Load from HTTP
\. https://raw.githubusercontent.com/example/repo/main/schema.sql
-- Explicit local file
\. file:///home/user/scripts/init.sql2. Other Potential Applications
--file/-fflag for batch execution--proto-descriptor-filefor protobuf descriptors- Any future features that need to load external resources
Implementation Notes
The core URI loading functions (loadFromURI, loadFromGCS, loadFromHTTP) are already implemented in sample_databases.go. These could be:
- Moved to a separate package/file (e.g.,
uri_loader.go) - Made more generic and reusable
- Extended with additional features like:
- Progress indicators for large files
- Caching support
- Authentication for private resources
Benefits
- Consistency: Same URI syntax across all file-loading operations
- Flexibility: Users can load scripts from various sources without manual downloading
- Cloud-native: Direct integration with GCS for Cloud Spanner users
- Convenience: Load scripts directly from GitHub, documentation sites, etc.
Related
- Add --sample-database flag for initializing embedded emulator with official samples #470 - Original implementation for
--sample-database
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels