-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_bricks_gcs_notes
More file actions
27 lines (18 loc) · 888 Bytes
/
data_bricks_gcs_notes
File metadata and controls
27 lines (18 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Key Components for GCS Access via ODBC:
1. Configure GCS Access (one-time per connection)
# Parse service account JSON and execute these SQL statements:
$dbh->do("SET fs.gs.auth.service.account.enable = true");
$dbh->do("SET fs.gs.project.id = '$project_id'");
$dbh->do("SET fs.gs.auth.service.account.email = '$client_email'");
$dbh->do("SET fs.gs.auth.service.account.private.key.id = '$private_key_id'");
$dbh->do("SET fs.gs.auth.service.account.private.key = '$private_key'");
Important: Escape single quotes in the private key: $private_key =~ s/'/\\'/g;
2. COPY INTO Syntax
COPY INTO target_table
FROM 'gs://bucket-name/path/to/files'
FILEFORMAT = CSV
FORMAT_OPTIONS ('header' = 'true')
No CREDENTIALS clause needed - authentication is handled by the Spark config set above.
3. Path Format
- S3: s3://bucket/path
- GCS: gs://bucket/path