cockroach userfile get command fetches the files stored in the user-scoped file storage which match the provided pattern, using a SQL connection. If no pattern is provided, all files in the specified (or default, if unspecified) user-scoped file storage will be fetched.
The user must have
CONNECT privileges on the target database.
A user can only fetch files from their own user-scoped storage, which is accessed through the userfile URI used during the upload. CockroachDB will revoke all access from every other user in the cluster except users in the
admin role and users explicitly granted access.
If this is your first interaction with user-scoped file storage, you may see an error indicating that you need
CREATE privileges on the database. You must first upload a file or run a
userfile before attempting to
get a file.
Fetch a file:
$ cockroach userfile get <file> [flags]
$ cockroach userfile get --help
||A comma-separated list of
||The path to the certificate directory containing the CA and client certificates and client key.
||Reveal the SQL statements sent implicitly by the command-line utility.|
||A connection URL to use instead of the other arguments.
Default: no URL
||The SQL user that will own the client session.
Get a specific file
To get the file named test-data.csv from the default user-scoped storage location for the current user:
$ cockroach userfile get test-data.csv --certs-dir=certs
Get a file saved to an explicit local file name
To get a file named test-data.csv from a local directory:
$ cockroach userfile get test-data.csv /Users/maxroach/Desktop/test-data.csv --certs-dir=certs
Get a file from a non-default userfile URI
If you uploaded a file to a non-default userfile URI (e.g.,
userfile://testdb.public.uploads), use the same URI to fetch it:
cockroach userfile get userfile://testdb.public.uploads/test-data.csv --certs-dir=certs
Get files that match the provided pattern
To get all files that match a pattern, use *:
$ cockroach userfile get '*.csv' --certs-dir=certs
cockroach userfile upload
cockroach userfile delete
cockroach userfile list
userfilefor Bulk Operations
- Other Cockroach Commands