Skip to content

Commit 13e7b49

Browse files
committed
fix: refactor bigtable package to api folder (#14)
moved bigtable to tfensorflow_io.python.api
1 parent c703514 commit 13e7b49

File tree

3 files changed

+12
-34
lines changed

3 files changed

+12
-34
lines changed

docs/tutorials/bigtable.ipynb

+9-9
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
"source": [
234234
"import tensorflow as tf\n",
235235
"import numpy as np\n",
236-
"import tensorflow_io.bigtable as bt\n",
236+
"import tensorflow_io as tfio\n",
237237
"import random\n",
238238
"\n",
239239
"random.seed(10)"
@@ -268,7 +268,7 @@
268268
"# If using your bigtable instance replace the project_id, instance_id \n",
269269
"# and the name of the table with suitable values.\n",
270270
"\n",
271-
"client = bt.BigtableClient(project_id=\"test-project\", instance_id=\"test-instance\")\n",
271+
"client = tfio.bigtable.BigtableClient(project_id=\"test-project\", instance_id=\"test-instance\")\n",
272272
"train_table = client.get_table(\"t1\")"
273273
]
274274
},
@@ -298,7 +298,7 @@
298298
},
299299
"outputs": [],
300300
"source": [
301-
"row_set = bt.row_set.from_rows_or_ranges(bt.row_range.infinite())\n",
301+
"row_set = tfio.bigtable.row_set.from_rows_or_ranges(tfio.bigtable.row_range.infinite())\n",
302302
"\n",
303303
"train_dataset = train_table.read_rows([\"cf1:c1\"],row_set, output_type=tf.string)\n",
304304
"\n",
@@ -364,9 +364,9 @@
364364
},
365365
"outputs": [],
366366
"source": [
367-
"row_range_below_300 = bt.row_range.right_open(\"row000\", \"row300\")\n",
367+
"row_range_below_300 = tfio.bigtable.row_range.right_open(\"row000\", \"row300\")\n",
368368
"\n",
369-
"my_row_set = bt.row_set.from_rows_or_ranges(row_range_below_300, \"row585\", \"row832\")\n",
369+
"my_row_set = tfio.bigtable.row_set.from_rows_or_ranges(row_range_below_300, \"row585\", \"row832\")\n",
370370
"print(my_row_set)"
371371
]
372372
},
@@ -390,8 +390,8 @@
390390
},
391391
"outputs": [],
392392
"source": [
393-
"my_truncated_row_set = bt.row_set.intersect(my_row_set,\n",
394-
" bt.row_range.right_open(\"row200\", \"row700\"))\n",
393+
"my_truncated_row_set = tfio.bigtable.row_set.intersect(my_row_set,\n",
394+
" tfio.bigtable.row_range.right_open(\"row200\", \"row700\"))\n",
395395
"print(my_truncated_row_set)"
396396
]
397397
},
@@ -426,8 +426,8 @@
426426
"\n",
427427
"start = datetime(2020, 10, 10, 12, 0, 0)\n",
428428
"end = datetime(2100, 10, 10, 13, 0, 0)\n",
429-
"from_datetime = bt.filters.timestamp_range(start, end)\n",
430-
"from_posix_timestamp = bt.filters.timestamp_range(int(start.timestamp()), int(end.timestamp()))\n",
429+
"from_datetime = tfio.bigtable.filters.timestamp_range(start, end)\n",
430+
"from_posix_timestamp = tfio.bigtable.filters.timestamp_range(int(start.timestamp()), int(end.timestamp()))\n",
431431
"print(\"from_datetime:\", from_datetime)\n",
432432
"\n",
433433
"print(\"from_posix_timestamp:\", from_posix_timestamp)"

tensorflow_io/python/api/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
1+
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
from tensorflow_io.python.api import audio
2525
from tensorflow_io.python.api import version
2626
from tensorflow_io.python.api import experimental
27+
from tensorflow_io.python.api import bigtable
2728

2829
if os.environ.get("GENERATING_TF_DOCS", ""):
2930
# Mark these as public api for /tools/docs/build_docs.py

tensorflow_io/bigtable.py renamed to tensorflow_io/python/api/bigtable.py

+1-24
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
# ==============================================================================
15-
"""Cloud Bigtable Client for TensorFlow.
15+
"""tensorflow_io.bigtable"""
1616

17-
This package allows TensorFlow to interface directly with Cloud Bigtable
18-
for high-speed data loading.
19-
20-
@@BigtableClient
21-
@@BigtableTable
22-
@@RowRange
23-
@@RowSet
24-
25-
26-
"""
27-
28-
29-
from tensorflow.python.util.all_util import remove_undocumented
3017
from tensorflow_io.python.ops.bigtable.bigtable_dataset_ops import BigtableClient
3118
from tensorflow_io.python.ops.bigtable.bigtable_dataset_ops import BigtableTable
3219
import tensorflow_io.python.ops.bigtable.bigtable_version_filters as filters
3320
import tensorflow_io.python.ops.bigtable.bigtable_row_set as row_set
3421
import tensorflow_io.python.ops.bigtable.bigtable_row_range as row_range
35-
36-
_allowed_symbols = [
37-
"BigtableClient",
38-
"BigtableTable",
39-
"filters",
40-
"row_set",
41-
"row_range",
42-
]
43-
44-
remove_undocumented(__name__, _allowed_symbols)

0 commit comments

Comments
 (0)