This repository has been archived by the owner on Jul 6, 2023. It is now read-only.
/
audit_data.py
974 lines (811 loc) · 36 KB
/
audit_data.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore
from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.bigquery.logging.v1",
manifest={
"AuditData",
"TableInsertRequest",
"TableUpdateRequest",
"TableInsertResponse",
"TableUpdateResponse",
"DatasetListRequest",
"DatasetInsertRequest",
"DatasetInsertResponse",
"DatasetUpdateRequest",
"DatasetUpdateResponse",
"JobInsertRequest",
"JobInsertResponse",
"JobQueryRequest",
"JobQueryResponse",
"JobGetQueryResultsRequest",
"JobGetQueryResultsResponse",
"JobQueryDoneResponse",
"JobCompletedEvent",
"TableDataReadEvent",
"TableDataListRequest",
"Table",
"TableInfo",
"TableViewDefinition",
"Dataset",
"DatasetInfo",
"BigQueryAcl",
"Job",
"JobConfiguration",
"TableDefinition",
"JobStatus",
"JobStatistics",
"DatasetName",
"TableName",
"JobName",
"EncryptionInfo",
},
)
class AuditData(proto.Message):
r"""BigQuery request and response messages for audit log. Note:
``Table.schema`` has been deprecated in favor of
``Table.schemaJson``. ``Table.schema`` may continue to be present in
your logs during this transition.
Attributes:
table_insert_request (google.cloud.bigquery_logging_v1.types.TableInsertRequest):
Table insert request.
table_update_request (google.cloud.bigquery_logging_v1.types.TableUpdateRequest):
Table update request.
dataset_list_request (google.cloud.bigquery_logging_v1.types.DatasetListRequest):
Dataset list request.
dataset_insert_request (google.cloud.bigquery_logging_v1.types.DatasetInsertRequest):
Dataset insert request.
dataset_update_request (google.cloud.bigquery_logging_v1.types.DatasetUpdateRequest):
Dataset update request.
job_insert_request (google.cloud.bigquery_logging_v1.types.JobInsertRequest):
Job insert request.
job_query_request (google.cloud.bigquery_logging_v1.types.JobQueryRequest):
Job query request.
job_get_query_results_request (google.cloud.bigquery_logging_v1.types.JobGetQueryResultsRequest):
Job get query results request.
table_data_list_request (google.cloud.bigquery_logging_v1.types.TableDataListRequest):
Table data-list request.
set_iam_policy_request (google.iam.v1.iam_policy_pb2.SetIamPolicyRequest):
Iam policy request.
table_insert_response (google.cloud.bigquery_logging_v1.types.TableInsertResponse):
Table insert response.
table_update_response (google.cloud.bigquery_logging_v1.types.TableUpdateResponse):
Table update response.
dataset_insert_response (google.cloud.bigquery_logging_v1.types.DatasetInsertResponse):
Dataset insert response.
dataset_update_response (google.cloud.bigquery_logging_v1.types.DatasetUpdateResponse):
Dataset update response.
job_insert_response (google.cloud.bigquery_logging_v1.types.JobInsertResponse):
Job insert response.
job_query_response (google.cloud.bigquery_logging_v1.types.JobQueryResponse):
Job query response.
job_get_query_results_response (google.cloud.bigquery_logging_v1.types.JobGetQueryResultsResponse):
Job get query results response.
job_query_done_response (google.cloud.bigquery_logging_v1.types.JobQueryDoneResponse):
Deprecated: Job query-done response. Use this
information for usage analysis.
policy_response (google.iam.v1.policy_pb2.Policy):
Iam Policy.
job_completed_event (google.cloud.bigquery_logging_v1.types.JobCompletedEvent):
A job completion event.
table_data_read_events (Sequence[google.cloud.bigquery_logging_v1.types.TableDataReadEvent]):
Information about the table access events.
"""
table_insert_request = proto.Field(
proto.MESSAGE, number=1, oneof="request", message="TableInsertRequest",
)
table_update_request = proto.Field(
proto.MESSAGE, number=16, oneof="request", message="TableUpdateRequest",
)
dataset_list_request = proto.Field(
proto.MESSAGE, number=2, oneof="request", message="DatasetListRequest",
)
dataset_insert_request = proto.Field(
proto.MESSAGE, number=3, oneof="request", message="DatasetInsertRequest",
)
dataset_update_request = proto.Field(
proto.MESSAGE, number=4, oneof="request", message="DatasetUpdateRequest",
)
job_insert_request = proto.Field(
proto.MESSAGE, number=5, oneof="request", message="JobInsertRequest",
)
job_query_request = proto.Field(
proto.MESSAGE, number=6, oneof="request", message="JobQueryRequest",
)
job_get_query_results_request = proto.Field(
proto.MESSAGE, number=7, oneof="request", message="JobGetQueryResultsRequest",
)
table_data_list_request = proto.Field(
proto.MESSAGE, number=8, oneof="request", message="TableDataListRequest",
)
set_iam_policy_request = proto.Field(
proto.MESSAGE,
number=20,
oneof="request",
message=iam_policy_pb2.SetIamPolicyRequest,
)
table_insert_response = proto.Field(
proto.MESSAGE, number=9, oneof="response", message="TableInsertResponse",
)
table_update_response = proto.Field(
proto.MESSAGE, number=10, oneof="response", message="TableUpdateResponse",
)
dataset_insert_response = proto.Field(
proto.MESSAGE, number=11, oneof="response", message="DatasetInsertResponse",
)
dataset_update_response = proto.Field(
proto.MESSAGE, number=12, oneof="response", message="DatasetUpdateResponse",
)
job_insert_response = proto.Field(
proto.MESSAGE, number=18, oneof="response", message="JobInsertResponse",
)
job_query_response = proto.Field(
proto.MESSAGE, number=13, oneof="response", message="JobQueryResponse",
)
job_get_query_results_response = proto.Field(
proto.MESSAGE,
number=14,
oneof="response",
message="JobGetQueryResultsResponse",
)
job_query_done_response = proto.Field(
proto.MESSAGE, number=15, oneof="response", message="JobQueryDoneResponse",
)
policy_response = proto.Field(
proto.MESSAGE, number=21, oneof="response", message=policy_pb2.Policy,
)
job_completed_event = proto.Field(
proto.MESSAGE, number=17, message="JobCompletedEvent",
)
table_data_read_events = proto.RepeatedField(
proto.MESSAGE, number=19, message="TableDataReadEvent",
)
class TableInsertRequest(proto.Message):
r"""Table insert request.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Table):
The new table.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Table",)
class TableUpdateRequest(proto.Message):
r"""Table update request.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Table):
The table to be updated.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Table",)
class TableInsertResponse(proto.Message):
r"""Table insert response.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Table):
Final state of the inserted table.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Table",)
class TableUpdateResponse(proto.Message):
r"""Table update response.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Table):
Final state of the updated table.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Table",)
class DatasetListRequest(proto.Message):
r"""Dataset list request.
Attributes:
list_all (bool):
Whether to list all datasets, including
hidden ones.
"""
list_all = proto.Field(proto.BOOL, number=1,)
class DatasetInsertRequest(proto.Message):
r"""Dataset insert request.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Dataset):
The dataset to be inserted.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Dataset",)
class DatasetInsertResponse(proto.Message):
r"""Dataset insert response.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Dataset):
Final state of the inserted dataset.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Dataset",)
class DatasetUpdateRequest(proto.Message):
r"""Dataset update request.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Dataset):
The dataset to be updated.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Dataset",)
class DatasetUpdateResponse(proto.Message):
r"""Dataset update response.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Dataset):
Final state of the updated dataset.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Dataset",)
class JobInsertRequest(proto.Message):
r"""Job insert request.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Job):
Job insert request.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Job",)
class JobInsertResponse(proto.Message):
r"""Job insert response.
Attributes:
resource (google.cloud.bigquery_logging_v1.types.Job):
Job insert response.
"""
resource = proto.Field(proto.MESSAGE, number=1, message="Job",)
class JobQueryRequest(proto.Message):
r"""Job query request.
Attributes:
query (str):
The query.
max_results (int):
The maximum number of results.
default_dataset (google.cloud.bigquery_logging_v1.types.DatasetName):
The default dataset for tables that do not
have a dataset specified.
project_id (str):
Project that the query should be charged to.
dry_run (bool):
If true, don't actually run the job. Just
check that it would run.
"""
query = proto.Field(proto.STRING, number=1,)
max_results = proto.Field(proto.UINT32, number=2,)
default_dataset = proto.Field(proto.MESSAGE, number=3, message="DatasetName",)
project_id = proto.Field(proto.STRING, number=4,)
dry_run = proto.Field(proto.BOOL, number=5,)
class JobQueryResponse(proto.Message):
r"""Job query response.
Attributes:
total_results (int):
The total number of rows in the full query
result set.
job (google.cloud.bigquery_logging_v1.types.Job):
Information about the queried job.
"""
total_results = proto.Field(proto.UINT64, number=1,)
job = proto.Field(proto.MESSAGE, number=2, message="Job",)
class JobGetQueryResultsRequest(proto.Message):
r"""Job getQueryResults request.
Attributes:
max_results (int):
Maximum number of results to return.
start_row (int):
Zero-based row number at which to start.
"""
max_results = proto.Field(proto.UINT32, number=1,)
start_row = proto.Field(proto.UINT64, number=2,)
class JobGetQueryResultsResponse(proto.Message):
r"""Job getQueryResults response.
Attributes:
total_results (int):
Total number of results in query results.
job (google.cloud.bigquery_logging_v1.types.Job):
The job that was created to run the query. It completed if
``job.status.state`` is ``DONE``. It failed if
``job.status.errorResult`` is also present.
"""
total_results = proto.Field(proto.UINT64, number=1,)
job = proto.Field(proto.MESSAGE, number=2, message="Job",)
class JobQueryDoneResponse(proto.Message):
r"""Job getQueryDone response.
Attributes:
job (google.cloud.bigquery_logging_v1.types.Job):
The job and status information. The job completed if
``job.status.state`` is ``DONE``.
"""
job = proto.Field(proto.MESSAGE, number=1, message="Job",)
class JobCompletedEvent(proto.Message):
r"""Query job completed event.
Attributes:
event_name (str):
Name of the event.
job (google.cloud.bigquery_logging_v1.types.Job):
Job information.
"""
event_name = proto.Field(proto.STRING, number=1,)
job = proto.Field(proto.MESSAGE, number=2, message="Job",)
class TableDataReadEvent(proto.Message):
r"""Table data read event. Only present for tables, not views,
and is only included in the log record for the project that owns
the table.
Attributes:
table_name (google.cloud.bigquery_logging_v1.types.TableName):
Name of the accessed table.
referenced_fields (Sequence[str]):
A list of referenced fields. This information
is not included by default. To enable this in
the logs, please contact BigQuery support or
open a bug in the BigQuery issue tracker.
"""
table_name = proto.Field(proto.MESSAGE, number=1, message="TableName",)
referenced_fields = proto.RepeatedField(proto.STRING, number=2,)
class TableDataListRequest(proto.Message):
r"""Table data-list request.
Attributes:
start_row (int):
Starting row offset.
max_results (int):
Maximum number of results to return.
"""
start_row = proto.Field(proto.UINT64, number=1,)
max_results = proto.Field(proto.UINT32, number=2,)
class Table(proto.Message):
r"""Describes a BigQuery table. See the
`Table </bigquery/docs/reference/v2/tables>`__ API resource for more
details on individual fields. Note: ``Table.schema`` has been
deprecated in favor of ``Table.schemaJson``. ``Table.schema`` may
continue to be present in your logs during this transition.
Attributes:
table_name (google.cloud.bigquery_logging_v1.types.TableName):
The name of the table.
info (google.cloud.bigquery_logging_v1.types.TableInfo):
User-provided metadata for the table.
schema_json (str):
A JSON representation of the table's schema.
view (google.cloud.bigquery_logging_v1.types.TableViewDefinition):
If present, this is a virtual table defined
by a SQL query.
expire_time (google.protobuf.timestamp_pb2.Timestamp):
The expiration date for the table, after
which the table is deleted and the storage
reclaimed. If not present, the table persists
indefinitely.
create_time (google.protobuf.timestamp_pb2.Timestamp):
The time the table was created.
truncate_time (google.protobuf.timestamp_pb2.Timestamp):
The time the table was last truncated by an operation with a
``writeDisposition`` of ``WRITE_TRUNCATE``.
update_time (google.protobuf.timestamp_pb2.Timestamp):
The time the table was last modified.
encryption (google.cloud.bigquery_logging_v1.types.EncryptionInfo):
The table encryption information. Set when
non-default encryption is used.
"""
table_name = proto.Field(proto.MESSAGE, number=1, message="TableName",)
info = proto.Field(proto.MESSAGE, number=2, message="TableInfo",)
schema_json = proto.Field(proto.STRING, number=8,)
view = proto.Field(proto.MESSAGE, number=4, message="TableViewDefinition",)
expire_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,)
create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,)
truncate_time = proto.Field(
proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,
)
update_time = proto.Field(proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,)
encryption = proto.Field(proto.MESSAGE, number=10, message="EncryptionInfo",)
class TableInfo(proto.Message):
r"""User-provided metadata for a table.
Attributes:
friendly_name (str):
A short name for the table, such
as\ ``"Analytics Data - Jan 2011"``.
description (str):
A long description, perhaps several
paragraphs, describing the table contents in
detail.
labels (Sequence[google.cloud.bigquery_logging_v1.types.TableInfo.LabelsEntry]):
Labels provided for the table.
"""
friendly_name = proto.Field(proto.STRING, number=1,)
description = proto.Field(proto.STRING, number=2,)
labels = proto.MapField(proto.STRING, proto.STRING, number=3,)
class TableViewDefinition(proto.Message):
r"""Describes a virtual table defined by a SQL query.
Attributes:
query (str):
SQL query defining the view.
"""
query = proto.Field(proto.STRING, number=1,)
class Dataset(proto.Message):
r"""BigQuery dataset information. See the
`Dataset </bigquery/docs/reference/v2/datasets>`__ API resource for
more details on individual fields.
Attributes:
dataset_name (google.cloud.bigquery_logging_v1.types.DatasetName):
The name of the dataset.
info (google.cloud.bigquery_logging_v1.types.DatasetInfo):
User-provided metadata for the dataset.
create_time (google.protobuf.timestamp_pb2.Timestamp):
The time the dataset was created.
update_time (google.protobuf.timestamp_pb2.Timestamp):
The time the dataset was last modified.
acl (google.cloud.bigquery_logging_v1.types.BigQueryAcl):
The access control list for the dataset.
default_table_expire_duration (google.protobuf.duration_pb2.Duration):
If this field is present, each table that does not specify
an expiration time is assigned an expiration time by adding
this duration to the table's ``createTime``. If this field
is empty, there is no default table expiration time.
"""
dataset_name = proto.Field(proto.MESSAGE, number=1, message="DatasetName",)
info = proto.Field(proto.MESSAGE, number=2, message="DatasetInfo",)
create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,)
update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,)
acl = proto.Field(proto.MESSAGE, number=6, message="BigQueryAcl",)
default_table_expire_duration = proto.Field(
proto.MESSAGE, number=8, message=duration_pb2.Duration,
)
class DatasetInfo(proto.Message):
r"""User-provided metadata for a dataset.
Attributes:
friendly_name (str):
A short name for the dataset, such
as\ ``"Analytics Data 2011"``.
description (str):
A long description, perhaps several
paragraphs, describing the dataset contents in
detail.
labels (Sequence[google.cloud.bigquery_logging_v1.types.DatasetInfo.LabelsEntry]):
Labels provided for the dataset.
"""
friendly_name = proto.Field(proto.STRING, number=1,)
description = proto.Field(proto.STRING, number=2,)
labels = proto.MapField(proto.STRING, proto.STRING, number=3,)
class BigQueryAcl(proto.Message):
r"""An access control list.
Attributes:
entries (Sequence[google.cloud.bigquery_logging_v1.types.BigQueryAcl.Entry]):
Access control entry list.
"""
class Entry(proto.Message):
r"""Access control entry.
Attributes:
role (str):
The granted role, which can be ``READER``, ``WRITER``, or
``OWNER``.
group_email (str):
Grants access to a group identified by an
email address.
user_email (str):
Grants access to a user identified by an
email address.
domain (str):
Grants access to all members of a domain.
special_group (str):
Grants access to special groups. Valid groups are
``PROJECT_OWNERS``, ``PROJECT_READERS``, ``PROJECT_WRITERS``
and ``ALL_AUTHENTICATED_USERS``.
view_name (google.cloud.bigquery_logging_v1.types.TableName):
Grants access to a BigQuery View.
"""
role = proto.Field(proto.STRING, number=1,)
group_email = proto.Field(proto.STRING, number=2,)
user_email = proto.Field(proto.STRING, number=3,)
domain = proto.Field(proto.STRING, number=4,)
special_group = proto.Field(proto.STRING, number=5,)
view_name = proto.Field(proto.MESSAGE, number=6, message="TableName",)
entries = proto.RepeatedField(proto.MESSAGE, number=1, message=Entry,)
class Job(proto.Message):
r"""Describes a job.
Attributes:
job_name (google.cloud.bigquery_logging_v1.types.JobName):
Job name.
job_configuration (google.cloud.bigquery_logging_v1.types.JobConfiguration):
Job configuration.
job_status (google.cloud.bigquery_logging_v1.types.JobStatus):
Job status.
job_statistics (google.cloud.bigquery_logging_v1.types.JobStatistics):
Job statistics.
"""
job_name = proto.Field(proto.MESSAGE, number=1, message="JobName",)
job_configuration = proto.Field(
proto.MESSAGE, number=2, message="JobConfiguration",
)
job_status = proto.Field(proto.MESSAGE, number=3, message="JobStatus",)
job_statistics = proto.Field(proto.MESSAGE, number=4, message="JobStatistics",)
class JobConfiguration(proto.Message):
r"""Job configuration information. See the
`Jobs </bigquery/docs/reference/v2/jobs>`__ API resource for more
details on individual fields.
Attributes:
query (google.cloud.bigquery_logging_v1.types.JobConfiguration.Query):
Query job information.
load (google.cloud.bigquery_logging_v1.types.JobConfiguration.Load):
Load job information.
extract (google.cloud.bigquery_logging_v1.types.JobConfiguration.Extract):
Extract job information.
table_copy (google.cloud.bigquery_logging_v1.types.JobConfiguration.TableCopy):
TableCopy job information.
dry_run (bool):
If true, don't actually run the job. Just
check that it would run.
labels (Sequence[google.cloud.bigquery_logging_v1.types.JobConfiguration.LabelsEntry]):
Labels provided for the job.
"""
class Query(proto.Message):
r"""Describes a query job, which executes a SQL-like query.
Attributes:
query (str):
The SQL query to run.
destination_table (google.cloud.bigquery_logging_v1.types.TableName):
The table where results are written.
create_disposition (str):
Describes when a job is allowed to create a table:
``CREATE_IF_NEEDED``, ``CREATE_NEVER``.
write_disposition (str):
Describes how writes affect existing tables:
``WRITE_TRUNCATE``, ``WRITE_APPEND``, ``WRITE_EMPTY``.
default_dataset (google.cloud.bigquery_logging_v1.types.DatasetName):
If a table name is specified without a
dataset in a query, this dataset will be added
to table name.
table_definitions (Sequence[google.cloud.bigquery_logging_v1.types.TableDefinition]):
Describes data sources outside BigQuery, if
needed.
query_priority (str):
Describes the priority given to the query:
``QUERY_INTERACTIVE`` or ``QUERY_BATCH``.
destination_table_encryption (google.cloud.bigquery_logging_v1.types.EncryptionInfo):
Result table encryption information. Set when
non-default encryption is used.
statement_type (str):
Type of the statement (e.g. SELECT, INSERT, CREATE_TABLE,
CREATE_MODEL..)
"""
query = proto.Field(proto.STRING, number=1,)
destination_table = proto.Field(proto.MESSAGE, number=2, message="TableName",)
create_disposition = proto.Field(proto.STRING, number=3,)
write_disposition = proto.Field(proto.STRING, number=4,)
default_dataset = proto.Field(proto.MESSAGE, number=5, message="DatasetName",)
table_definitions = proto.RepeatedField(
proto.MESSAGE, number=6, message="TableDefinition",
)
query_priority = proto.Field(proto.STRING, number=7,)
destination_table_encryption = proto.Field(
proto.MESSAGE, number=8, message="EncryptionInfo",
)
statement_type = proto.Field(proto.STRING, number=9,)
class Load(proto.Message):
r"""Describes a load job, which loads data from an external
source via the import pipeline.
Attributes:
source_uris (Sequence[str]):
URIs for the data to be imported. Only Google
Cloud Storage URIs are supported.
schema_json (str):
The table schema in JSON format
representation of a TableSchema.
destination_table (google.cloud.bigquery_logging_v1.types.TableName):
The table where the imported data is written.
create_disposition (str):
Describes when a job is allowed to create a table:
``CREATE_IF_NEEDED``, ``CREATE_NEVER``.
write_disposition (str):
Describes how writes affect existing tables:
``WRITE_TRUNCATE``, ``WRITE_APPEND``, ``WRITE_EMPTY``.
destination_table_encryption (google.cloud.bigquery_logging_v1.types.EncryptionInfo):
Result table encryption information. Set when
non-default encryption is used.
"""
source_uris = proto.RepeatedField(proto.STRING, number=1,)
schema_json = proto.Field(proto.STRING, number=6,)
destination_table = proto.Field(proto.MESSAGE, number=3, message="TableName",)
create_disposition = proto.Field(proto.STRING, number=4,)
write_disposition = proto.Field(proto.STRING, number=5,)
destination_table_encryption = proto.Field(
proto.MESSAGE, number=7, message="EncryptionInfo",
)
class Extract(proto.Message):
r"""Describes an extract job, which exports data to an external
source via the export pipeline.
Attributes:
destination_uris (Sequence[str]):
Google Cloud Storage URIs where extracted
data should be written.
source_table (google.cloud.bigquery_logging_v1.types.TableName):
The source table.
"""
destination_uris = proto.RepeatedField(proto.STRING, number=1,)
source_table = proto.Field(proto.MESSAGE, number=2, message="TableName",)
class TableCopy(proto.Message):
r"""Describes a copy job, which copies an existing table to
another table.
Attributes:
source_tables (Sequence[google.cloud.bigquery_logging_v1.types.TableName]):
Source tables.
destination_table (google.cloud.bigquery_logging_v1.types.TableName):
Destination table.
create_disposition (str):
Describes when a job is allowed to create a table:
``CREATE_IF_NEEDED``, ``CREATE_NEVER``.
write_disposition (str):
Describes how writes affect existing tables:
``WRITE_TRUNCATE``, ``WRITE_APPEND``, ``WRITE_EMPTY``.
destination_table_encryption (google.cloud.bigquery_logging_v1.types.EncryptionInfo):
Result table encryption information. Set when
non-default encryption is used.
"""
source_tables = proto.RepeatedField(
proto.MESSAGE, number=1, message="TableName",
)
destination_table = proto.Field(proto.MESSAGE, number=2, message="TableName",)
create_disposition = proto.Field(proto.STRING, number=3,)
write_disposition = proto.Field(proto.STRING, number=4,)
destination_table_encryption = proto.Field(
proto.MESSAGE, number=5, message="EncryptionInfo",
)
query = proto.Field(proto.MESSAGE, number=5, oneof="configuration", message=Query,)
load = proto.Field(proto.MESSAGE, number=6, oneof="configuration", message=Load,)
extract = proto.Field(
proto.MESSAGE, number=7, oneof="configuration", message=Extract,
)
table_copy = proto.Field(
proto.MESSAGE, number=8, oneof="configuration", message=TableCopy,
)
dry_run = proto.Field(proto.BOOL, number=9,)
labels = proto.MapField(proto.STRING, proto.STRING, number=3,)
class TableDefinition(proto.Message):
r"""Describes an external data source used in a query.
Attributes:
name (str):
Name of the table, used in queries.
source_uris (Sequence[str]):
Google Cloud Storage URIs for the data to be
imported.
"""
name = proto.Field(proto.STRING, number=1,)
source_uris = proto.RepeatedField(proto.STRING, number=2,)
class JobStatus(proto.Message):
r"""Running state of a job.
Attributes:
state (str):
State of a job: ``PENDING``, ``RUNNING``, or ``DONE``.
error (google.rpc.status_pb2.Status):
If the job did not complete successfully,
this field describes why.
additional_errors (Sequence[google.rpc.status_pb2.Status]):
Errors encountered during the running of the
job. Do not necessarily mean that the job has
completed or was unsuccessful.
"""
state = proto.Field(proto.STRING, number=1,)
error = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,)
additional_errors = proto.RepeatedField(
proto.MESSAGE, number=3, message=status_pb2.Status,
)
class JobStatistics(proto.Message):
r"""Job statistics that may change after a job starts.
Attributes:
create_time (google.protobuf.timestamp_pb2.Timestamp):
Time when the job was created.
start_time (google.protobuf.timestamp_pb2.Timestamp):
Time when the job started.
end_time (google.protobuf.timestamp_pb2.Timestamp):
Time when the job ended.
total_processed_bytes (int):
Total bytes processed for a job.
total_billed_bytes (int):
Processed bytes, adjusted by the job's CPU
usage.
billing_tier (int):
The tier assigned by CPU-based billing.
total_slot_ms (int):
The total number of slot-ms consumed by the
query job.
reservation_usage (Sequence[google.cloud.bigquery_logging_v1.types.JobStatistics.ReservationResourceUsage]):
Reservation usage.
referenced_tables (Sequence[google.cloud.bigquery_logging_v1.types.TableName]):
The first N tables accessed by the query job. Older queries
that reference a large number of tables may not have all of
their tables in this list. You can use the
total_tables_processed count to know how many total tables
were read in the query. For new queries, there is currently
no limit.
total_tables_processed (int):
Total number of unique tables referenced in
the query.
referenced_views (Sequence[google.cloud.bigquery_logging_v1.types.TableName]):
The first N views accessed by the query job. Older queries
that reference a large number of views may not have all of
their views in this list. You can use the
total_tables_processed count to know how many total tables
were read in the query. For new queries, there is currently
no limit.
total_views_processed (int):
Total number of unique views referenced in
the query.
query_output_row_count (int):
Number of output rows produced by the query
job.
total_load_output_bytes (int):
Total bytes loaded for an import job.
"""
class ReservationResourceUsage(proto.Message):
r"""Job resource usage breakdown by reservation.
Attributes:
name (str):
Reservation name or "unreserved" for on-
emand resources usage.
slot_ms (int):
Total slot milliseconds used by the
reservation for a particular job.
"""
name = proto.Field(proto.STRING, number=1,)
slot_ms = proto.Field(proto.INT64, number=2,)
create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,)
start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,)
end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,)
total_processed_bytes = proto.Field(proto.INT64, number=4,)
total_billed_bytes = proto.Field(proto.INT64, number=5,)
billing_tier = proto.Field(proto.INT32, number=7,)
total_slot_ms = proto.Field(proto.INT64, number=8,)
reservation_usage = proto.RepeatedField(
proto.MESSAGE, number=14, message=ReservationResourceUsage,
)
referenced_tables = proto.RepeatedField(
proto.MESSAGE, number=9, message="TableName",
)
total_tables_processed = proto.Field(proto.INT32, number=10,)
referenced_views = proto.RepeatedField(
proto.MESSAGE, number=11, message="TableName",
)
total_views_processed = proto.Field(proto.INT32, number=12,)
query_output_row_count = proto.Field(proto.INT64, number=15,)
total_load_output_bytes = proto.Field(proto.INT64, number=13,)
class DatasetName(proto.Message):
r"""The fully-qualified name for a dataset.
Attributes:
project_id (str):
The project ID.
dataset_id (str):
The dataset ID within the project.
"""
project_id = proto.Field(proto.STRING, number=1,)
dataset_id = proto.Field(proto.STRING, number=2,)
class TableName(proto.Message):
r"""The fully-qualified name for a table.
Attributes:
project_id (str):
The project ID.
dataset_id (str):
The dataset ID within the project.
table_id (str):
The table ID of the table within the dataset.
"""
project_id = proto.Field(proto.STRING, number=1,)
dataset_id = proto.Field(proto.STRING, number=2,)
table_id = proto.Field(proto.STRING, number=3,)
class JobName(proto.Message):
r"""The fully-qualified name for a job.
Attributes:
project_id (str):
The project ID.
job_id (str):
The job ID within the project.
location (str):
The job location.
"""
project_id = proto.Field(proto.STRING, number=1,)
job_id = proto.Field(proto.STRING, number=2,)
location = proto.Field(proto.STRING, number=3,)
class EncryptionInfo(proto.Message):
r"""Describes encryption properties for a table or a job
Attributes:
kms_key_name (str):
unique identifier for cloud kms key
"""
kms_key_name = proto.Field(proto.STRING, number=1,)
__all__ = tuple(sorted(__protobuf__.manifest))