Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ed9cce

Browse files
chalmerloweEthanSteinbergtswast
authored
feat: Add compression option ZSTD. (#1890)
* Add ZSTD to compression types* feat: adds tests re Compression types* revise datatype from Enum to object* adds license text and docstring* change object back to enum datatype* updates compression object comparison* updates Compression class* jsonify and sort the input and output for testing* Update tests/unit/job/test_extract.py* moved json import statement* removed enums test and file---------Co-authored-by: Ethan Steinberg <ethan.steinberg@gmail.com>Co-authored-by: Tim Sweña (Swast) <swast@google.com>
1 parent19394ab commit5ed9cce

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

‎google/cloud/bigquery/enums.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AutoRowIDs(enum.Enum):
2222
GENERATE_UUID=enum.auto()
2323

2424

25-
classCompression(object):
25+
classCompression(str,enum.Enum):
2626
"""The compression type to use for exported files. The default value is
2727
:attr:`NONE`.
2828
@@ -39,6 +39,9 @@ class Compression(object):
3939
SNAPPY="SNAPPY"
4040
"""Specifies SNAPPY format."""
4141

42+
ZSTD="ZSTD"
43+
"""Specifies ZSTD format."""
44+
4245
NONE="NONE"
4346
"""Specifies no compression."""
4447

‎tests/unit/job/test_extract.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
importjson
1516
fromunittestimportmock
1617

1718
from ..helpersimportmake_connection
@@ -45,9 +46,8 @@ def test_to_api_repr(self):
4546
config.print_header=False
4647
config._properties["extract"]["someNewField"]="some-value"
4748
config.use_avro_logical_types=True
48-
resource=config.to_api_repr()
49-
self.assertEqual(
50-
resource,
49+
resource=json.dumps(config.to_api_repr(),sort_keys=True)
50+
expected=json.dumps(
5151
{
5252
"extract": {
5353
"compression":"SNAPPY",
@@ -58,6 +58,12 @@ def test_to_api_repr(self):
5858
"useAvroLogicalTypes":True,
5959
}
6060
},
61+
sort_keys=True,
62+
)
63+
64+
self.assertEqual(
65+
resource,
66+
expected,
6167
)
6268

6369
deftest_from_api_repr(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp