Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/google/cloud/bigquery_storage_v1/types/avro.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-26 06:10 +0000

1# -*- coding: utf-8 -*- 

2# Copyright 2022 Google LLC 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); 

5# you may not use this file except in compliance with the License. 

6# You may obtain a copy of the License at 

7# 

8# http://www.apache.org/licenses/LICENSE-2.0 

9# 

10# Unless required by applicable law or agreed to in writing, software 

11# distributed under the License is distributed on an "AS IS" BASIS, 

12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

13# See the License for the specific language governing permissions and 

14# limitations under the License. 

15# 

16from __future__ import annotations 

17 

18from typing import MutableMapping, MutableSequence 

19 

20import proto # type: ignore 

21 

22 

23__protobuf__ = proto.module( 

24 package="google.cloud.bigquery.storage.v1", 

25 manifest={ 

26 "AvroSchema", 

27 "AvroRows", 

28 "AvroSerializationOptions", 

29 }, 

30) 

31 

32 

33class AvroSchema(proto.Message): 

34 r"""Avro schema. 

35 

36 Attributes: 

37 schema (str): 

38 Json serialized schema, as described at 

39 https://avro.apache.org/docs/1.8.1/spec.html. 

40 """ 

41 

42 schema: str = proto.Field( 

43 proto.STRING, 

44 number=1, 

45 ) 

46 

47 

48class AvroRows(proto.Message): 

49 r"""Avro rows. 

50 

51 Attributes: 

52 serialized_binary_rows (bytes): 

53 Binary serialized rows in a block. 

54 row_count (int): 

55 [Deprecated] The count of rows in the returning block. 

56 Please use the format-independent ReadRowsResponse.row_count 

57 instead. 

58 """ 

59 

60 serialized_binary_rows: bytes = proto.Field( 

61 proto.BYTES, 

62 number=1, 

63 ) 

64 row_count: int = proto.Field( 

65 proto.INT64, 

66 number=2, 

67 ) 

68 

69 

70class AvroSerializationOptions(proto.Message): 

71 r"""Contains options specific to Avro Serialization. 

72 

73 Attributes: 

74 enable_display_name_attribute (bool): 

75 Enable displayName attribute in Avro schema. 

76 The Avro specification requires field names to 

77 be alphanumeric. By default, in cases when 

78 column names do not conform to these 

79 requirements (e.g. non-ascii unicode codepoints) 

80 and Avro is requested as an output format, the 

81 CreateReadSession call will fail. 

82 Setting this field to true, populates avro field 

83 names with a placeholder value and populates a 

84 "displayName" attribute for every avro field 

85 with the original column name. 

86 """ 

87 

88 enable_display_name_attribute: bool = proto.Field( 

89 proto.BOOL, 

90 number=1, 

91 ) 

92 

93 

94__all__ = tuple(sorted(__protobuf__.manifest))