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

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

13 statements  

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

2# Copyright 2025 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__protobuf__ = proto.module( 

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

24 manifest={ 

25 "AvroSchema", 

26 "AvroRows", 

27 "AvroSerializationOptions", 

28 }, 

29) 

30 

31 

32class AvroSchema(proto.Message): 

33 r"""Avro schema. 

34 

35 Attributes: 

36 schema (str): 

37 Json serialized schema, as described at 

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

39 """ 

40 

41 schema: str = proto.Field( 

42 proto.STRING, 

43 number=1, 

44 ) 

45 

46 

47class AvroRows(proto.Message): 

48 r"""Avro rows. 

49 

50 Attributes: 

51 serialized_binary_rows (bytes): 

52 Binary serialized rows in a block. 

53 row_count (int): 

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

55 Please use the format-independent ReadRowsResponse.row_count 

56 instead. 

57 """ 

58 

59 serialized_binary_rows: bytes = proto.Field( 

60 proto.BYTES, 

61 number=1, 

62 ) 

63 row_count: int = proto.Field( 

64 proto.INT64, 

65 number=2, 

66 ) 

67 

68 

69class AvroSerializationOptions(proto.Message): 

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

71 

72 Attributes: 

73 enable_display_name_attribute (bool): 

74 Enable displayName attribute in Avro schema. 

75 

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 

83 Setting this field to true, populates avro field 

84 names with a placeholder value and populates a 

85 "displayName" attribute for every avro field 

86 with the original column name. 

87 """ 

88 

89 enable_display_name_attribute: bool = proto.Field( 

90 proto.BOOL, 

91 number=1, 

92 ) 

93 

94 

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