Database Reference
In-Depth Information
You may notice a new entry in each field:
encrypt
. This tells
ebq
how to
encrypt that field of the schema. The following section on encryption modes
describes the meaning of these values. First, however, create a dataset that
will hold your encrypted tables. The command line is the same as the normal
bq
usage:
$
ebq mk ch13
To encrypt and load the data, you can use the following command:
$
ebq --master_key_filename=ebq.key load \
--
source_format=NEWLINE_DELIMITED_JSON \
ch13.enc_shakes shakespeare.json
encrypted_schema.txt
You must specify a master key file via the
master_key_filename
flag;
this is the encryption key that will be used. If the encryption key doesn't
already exist, a new key file will be created. Otherwise, loading the encrypted
table looks just like a standard
bq load
command line. The encryption
process can be slow; you should allow plenty of time for the data to be
encrypted and the encrypted load operation to run. Because a special type
of encryption is being used, it is much slower than you might expect. The
Shakespeare table, which is not a large table, may take an hour or so to
complete encryption.
After the data has loaded, you can get information about the encrypted table
via
ebq show
(which is similar to the
bq show
command):
$
ebq --master_key_filename=ebq.key show
ch13.enc_shakes
Table bigquery-e2e:ch13.enc_shakes
Last modified
Schema Total Rows
-----------------
--------------------------------------- ------------
07 Feb 19:45:16 |- word: ciphertext
(required) 164656
|- word_count: ciphertext
(required)