Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
25d6fb7
Convert dataset usage examples to tested snippets.
tseaver May 27, 2016
3afd95b
Appease new flake8 checker.
tseaver May 28, 2016
8f00567
Docstring typo.
tseaver Jun 7, 2016
6afb58a
Remove stray line.
tseaver Jun 7, 2016
9d92808
Use Sphinx's ':envvar:' role.
tseaver Jun 7, 2016
47c2f0e
_LoggingAPI: impedance matching with JSON API.
tseaver Jun 22, 2016
a4022b6
Allow logging-over-gRPC.
tseaver Jun 23, 2016
da7cd1f
Adjust anchor scroll. closes #1897.
daspecster Jun 24, 2016
0337590
Add Logging to README.md. closes #1898.
daspecster Jun 24, 2016
43d9637
Add BigQuery example to README.md. closes #1899
daspecster Jun 24, 2016
a43b2eb
Split 'Makefile' into datastore and bigtable portions.
tseaver Jun 24, 2016
0f4a064
Generate Bigtable V2 protos.
tseaver Jun 24, 2016
9d7d8af
Exclude new '_generated_v2' files from coverage.
tseaver Jun 24, 2016
4bb2783
Add docs, exporting logging to storage permissions.
daspecster Jun 25, 2016
9a2d313
Drop 'Table.rename'.
tseaver Jun 26, 2016
f5b1719
Drop overlooked docs / system test usage of 'Table.rename'.
tseaver Jun 26, 2016
e570b03
Merge pull request #1903 from tseaver/bigtable-v2-regenerate_protobufs
tseaver Jun 26, 2016
16b04c9
Parse JSON acceptance tests.
tseaver Jun 25, 2016
ebf27b5
Add 'ReadRowsResponseV2' wrapper.
tseaver Jun 26, 2016
35103f9
Merge pull request #1908 from tseaver/bigtable-v2-drop_table_rename
tseaver Jun 26, 2016
ed8edb4
Disable GAX bundling for 'Topic.publish'.
tseaver Jun 26, 2016
b4f4d18
Drop '_GaxBundlingEvent' testing fossil.
tseaver Jun 26, 2016
47b9246
Alias Bigtable V1 imports / factories / entry point constants.
tseaver Jun 26, 2016
377f0da
Merge pull request #1907 from tseaver/bigtable-v2-read_rows_response_…
tseaver Jun 27, 2016
cdbc47c
Merge pull request #1912 from tseaver/bigtable-v2-alias_imports_endpo…
tseaver Jun 27, 2016
5ac80ba
Merge pull request #1910 from tseaver/1869-pubsub-disable_gax_bundlin…
tseaver Jun 27, 2016
3c533e0
Factor out generating GCRule-related protobufs.
tseaver Jun 26, 2016
7e9c61d
Update bigtable.column_family to use V2 protos.
tseaver Jun 26, 2016
ae3d818
Merge pull request #1913 from tseaver/bigtable-v2-column_family_crud
tseaver Jun 27, 2016
b0558ba
Merge pull request #1900 from daspecster/fix-anchor-link-scroll
daspecster Jun 27, 2016
5d179bc
Clarify: testcases leaving incomplete final rows do not raise.
tseaver Jun 27, 2016
6b2f07f
Distinguish response-level errors from invalid chunks.
tseaver Jun 27, 2016
c542ff8
Add BigQuery and Pub/Sub.
daspecster Jun 27, 2016
6e199fd
Fix LICENSE to match http://www.apache.org/licenses/LICENSE-2.0.txt
Jun 27, 2016
3918082
Add example of fetting log entries.
daspecster Jun 27, 2016
4d721fd
Merge pull request #1916 from bjwatson/fix-license
tseaver Jun 27, 2016
9ceac1e
Add CSV and query example for BigQuery.
daspecster Jun 27, 2016
fcc3751
Merge pull request #1915 from tseaver/bigtable-v2-readrowsresponse-er…
tseaver Jun 27, 2016
8916b6c
Factor out generating RowFilter-related protobufs.
tseaver Jun 27, 2016
1e4405e
Add pubsub and bigquery code examples for logging.
daspecster Jun 27, 2016
5c4db0d
Merge pull request #1901 from daspecster/add-logging-to-readme
daspecster Jun 27, 2016
ea50f55
Merge pull request #1905 from daspecster/add-logging-export-ownership…
daspecster Jun 27, 2016
1b0fb53
Convert to non-instance-admin Bigtable V2 protos.
tseaver Jun 27, 2016
dbb05e5
Merge pull request #1902 from daspecster/add-bigquery-example-to-readme
daspecster Jun 27, 2016
3b48e0f
Merge pull request #1919 from tseaver/bigtable-v2-convert_imports
tseaver Jun 27, 2016
95f2a20
Merge pull request #1894 from tseaver/logging-gax_via_envvar
tseaver Jun 27, 2016
4ed0b8f
Drop 'Cluster.table' and 'Cluster.list_tables'.
tseaver Jun 27, 2016
7cbb215
In V2, tables hold a ref. to their instance, not a cluster.
tseaver Jun 27, 2016
498271e
Add V2 Instance type.
tseaver Jun 27, 2016
84ac521
Closes #1922, resolves issues with GAE and expanduser().
daspecster Jun 28, 2016
e144b09
Convert instance admin to V2 protobufs.
tseaver Jun 28, 2016
9880a42
Adjust docs for V2 instance admin patterns.
tseaver Jun 28, 2016
90cd2e7
Merge pull request #1923 from tseaver/bigtable-v2-instance_admin
tseaver Jun 28, 2016
aa95442
Use 'grpcio-tools' in a virtualenv to generate latest Bigtable V2 pro…
tseaver Jun 28, 2016
d97d030
Remove duplicated line.
tseaver Jun 28, 2016
4a223b7
Use 'grpcio-tools' in a virtualenv to generate from latest Bigtable V…
tseaver Jun 28, 2016
568a463
Use 'grpcio-tools' in a virtualenv to generate from latest datastore …
tseaver Jun 28, 2016
24989d6
Accomodate final V2 renames: 'name' -> 'parent'.
tseaver Jun 28, 2016
6d3ff2e
Merge pull request #1925 from tseaver/bigtable-v2-generate_v2_protos_…
tseaver Jun 28, 2016
b1d56a5
Add cleanup and refactor.
daspecster Jun 28, 2016
a488a8a
More 'cluster' -> 'instance' renames.
tseaver Jun 28, 2016
7214045
Use (same) actual V2 admin endpoint host for instance / table admin.
tseaver Jun 28, 2016
c6b747e
Use class-level constants.
tseaver Jun 28, 2016
40f609e
Add 'Client.list_instances' method.
tseaver Jun 28, 2016
c87ca51
Clean out remaining refs to V1-generated code.
tseaver Jun 28, 2016
0ac2def
Merge pull request #1926 from tseaver/bigtable-v2-cleanups
tseaver Jun 28, 2016
3467d99
Work around borked gRPC generation for g.longrunning.operations.
tseaver Jun 28, 2016
784fe01
Revise Bigtable system tests to fit instance-based patterns.
tseaver Jun 28, 2016
024c7f3
Plumb cluster 'location'/'serve_nodes' through instance creation.
tseaver Jun 28, 2016
5e85b5d
CreateInstance operation name includes location.
tseaver Jun 28, 2016
d2c9daf
'Row/ColumnFamily._table' has '_instance'.
tseaver Jun 28, 2016
a01d02e
V2 UpdateTable no longer returns operation.
tseaver Jun 28, 2016
9bdeef7
'PartialRowData' no longer keeps 'committed' state.
tseaver Jun 28, 2016
ad5936c
Merge pull request #1924 from daspecster/fix-gae-default-project-id
daspecster Jun 28, 2016
893d451
Typo fix.
tseaver Jun 28, 2016
d8a01c2
Switch to passing location ID, rather than full path, to instance.
tseaver Jun 28, 2016
6f4aced
Lint fixes.
tseaver Jun 28, 2016
0c625c5
Merge pull request #1930 from tseaver/bigtable-v2-system_tests
tseaver Jun 29, 2016
82adc5e
Adjust to V2 'instance'-based patterns.
tseaver Jun 28, 2016
40b2016
Rename testcases for clarity.
tseaver Jun 28, 2016
9dfa823
'Table.read_rows': no responses -> None.
tseaver Jun 28, 2016
e92da5c
V2 wraps row for 'ReadModifyWriteRow' request in new response message
tseaver Jun 28, 2016
0e80bdd
happybase.Table.scan: proocess all rows from a single request.
tseaver Jun 28, 2016
d18a316
Valet service.
tseaver Jun 29, 2016
d085294
Merge pull request #1931 from tseaver/bigtable-v2-happybase
tseaver Jun 29, 2016
e0f59fa
Drop declaration of univeral wheel support.
tseaver Jun 29, 2016
3c6e03c
Don't release wheels from Travis.
tseaver Jun 29, 2016
4dc58fc
Merge pull request #1938 from tseaver/1879-disable-broken-wheel-building
tseaver Jun 29, 2016
05230c3
Prepare 0.17.0 release.
tseaver Jun 29, 2016
7a6b1c9
Fix typos in docs.
daspecster Jun 29, 2016
7f65402
Merge pull request #1941 from daspecster/docs-typos-logging-permissions
daspecster Jun 29, 2016
1a2fa6c
Merge pull request #1932 from GoogleCloudPlatform/bigtable-v2
tseaver Jun 29, 2016
d958f74
Merge pull request #1940 from tseaver/make-0.17.0-release
tseaver Jun 29, 2016
bf5e637
Fixed spelling and formatting.
mbrukman Jun 29, 2016
f00b050
Merge pull request #1945 from mbrukman/spelling-instances
tseaver Jun 30, 2016
3e9928c
Document required-for-new-instances 'location_id' parameter.
tseaver Jun 29, 2016
5ad2861
Replace somewhat convoluted paragraph.
tseaver Jun 29, 2016
0c52116
Typo fix.
tseaver Jun 29, 2016
081603c
Rephrase again.
tseaver Jun 30, 2016
3dd188f
Overlooked 'cluster' -> 'instance' rename in docs.
tseaver Jun 30, 2016
7d29482
Merge pull request #1948 from tseaver/bigtable-v2-lost-docs-fixes
tseaver Jun 30, 2016
ed0f77a
Re-enable bundling. Closes #1911
daspecster Jul 1, 2016
da259a8
Remove CallOptions and missed commented code.
daspecster Jul 1, 2016
dedbaf1
Pass project path to GAX 'list_sinks'/'list_log_metrics'.
tseaver Jul 1, 2016
5646bd5
Moar impedance mapping: JSON camelCase vs. proto with_underscore.
tseaver Jul 1, 2016
628ee9a
Merge pull request #1950 from daspecster/enable-pubsub-bundling
daspecster Jul 1, 2016
3a3613e
Add backoff to 'list_entries' calls for eventual consistency.
tseaver Jul 1, 2016
d662dd9
Properly unpack JSON payload in GAX 'list_entries'.
tseaver Jul 1, 2016
ac6bd5c
Impedance matching: JSON severity names vs. protobuf numbers.
tseaver Jul 1, 2016
54b39f7
Revert "Re-enable bundling (for consideration)"
tseaver Jul 1, 2016
88243b0
Fix pubsub context manager exit error. closes #1955
daspecster Jul 4, 2016
d49b048
Move messages check to commit()
daspecster Jul 4, 2016
eddc4e0
Merge pull request #1956 from daspecster/fix-pupsub-exit-context-no-c…
daspecster Jul 4, 2016
c28f3de
Fix #1957 - Typo in docs
jgeewax Jul 5, 2016
e7b9a28
Merge pull request #1958 from GoogleCloudPlatform/jgeewax-1957
tseaver Jul 5, 2016
de1dd84
Update references to cloud logging.
daspecster Jul 6, 2016
6ec956b
Update Monitoring references.
daspecster Jul 6, 2016
6ffe88d
Skip remainder of backoff loop on failure.
tseaver Jul 6, 2016
771bc7a
Merge pull request #1952 from tseaver/logging-fix_gax_system_tests
tseaver Jul 6, 2016
a2f4715
Fix sphinx warnings for headers.
daspecster Jul 6, 2016
9fbcdb7
Merge pull request #1962 from daspecster/update-cloud-logging-references
daspecster Jul 8, 2016
ff737ac
Attempt to un-break Appveyor:
tseaver Jul 8, 2016
804ec9f
Merge pull request #1965 from tseaver/1863-debug-missing-protobuf-on-…
tseaver Jul 8, 2016
6b4704b
Merge pull request #1954 from GoogleCloudPlatform/revert-1950-enable-…
tseaver Jul 8, 2016
e20df5d
Update disabled messages from new pylint.
daspecster Jul 8, 2016
56b1a01
Merge pull request #1967 from daspecster/update-pylint-settings
daspecster Jul 8, 2016
028ea3c
Change error for generating signed url.
daspecster Jul 8, 2016
6d3592f
Merge pull request #1966 from daspecster/change-error-for-sign-blob
daspecster Jul 8, 2016
c1c13be
Add quotes to CSV reference. closes #1970
daspecster Jul 11, 2016
d5dfcef
Appveyor: this-time-for-sure-rocky
tseaver Jul 11, 2016
aa56c9f
Merge pull request #1973 from tseaver/1863-appveyor-protobuf-this-tim…
tseaver Jul 11, 2016
844ec53
Drop unused imports flagged by pylint 1.6.
tseaver Jul 11, 2016
06800cf
Suppress new pylint 1.6 opinions for *all* files, not just tests.
tseaver Jul 11, 2016
dec0c8b
Suppress pylint-1.6-choking file.
tseaver Jul 11, 2016
7d17482
Continue testing all files in a set even if one exits w/ non-zero sta…
tseaver Jul 11, 2016
1285d8c
Skip checking two files which cause pylint 1.6 to barf.
tseaver Jul 11, 2016
2dcad57
Merge pull request #1832 from tseaver/bigquery-testable_dataset_snippets
tseaver Jul 11, 2016
a1620a9
Merge pull request #1974 from tseaver/pylint-disable-pylint-1.6-warni…
tseaver Jul 12, 2016
bbfefee
Attempt to fix windows path crash. closes #1975
daspecster Jul 12, 2016
7ea997c
Update DNS resource_record_set(). closes #1886
daspecster Jul 12, 2016
de6252e
Merge pull request #1976 from daspecster/fix-default-project-id-on-wi…
daspecster Jul 12, 2016
d9220c6
Merge pull request #1977 from daspecster/fix-dns-record-set-docs
daspecster Jul 12, 2016
a1b8066
Merge pull request #1971 from daspecster/big-table-doc-typos
daspecster Jul 12, 2016
6ae8385
Convert table usage examples to tested snippets.
tseaver May 27, 2016
aed487d
Merge pull request #1833 from tseaver/bigquery-testable_table_snippets
tseaver Jul 13, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[report]
omit =
*/_generated/*.py
*/_generated_v2/*.py
show_missing = True
exclude_lines =
# Re-enable the standard pragma
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ scripts/pylintrc_reduced
generated_python/
cloud-bigtable-client/
googleapis-pb/
grpc_python_venv/
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ deploy:
repo: GoogleCloudPlatform/gcloud-python
# until this is fixed: https://github.com/travis-ci/travis-ci/issues/1675
all_branches: true
distributions: "sdist bdist_wheel"
# 'bdist_wheel' builds disabled until #1879 et al. are resolved.
distributions: "sdist"

cache:
directories:
Expand Down
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Apache License

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

Expand Down Expand Up @@ -178,7 +179,7 @@ Apache License
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
Expand All @@ -199,4 +200,3 @@ Apache License
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.

56 changes: 24 additions & 32 deletions Makefile → Makefile.bigtable_v1
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
GRPCIO_VIRTUALENV=$(shell pwd)/grpc_python_venv
GENERATED_DIR=$(shell pwd)/generated_python
BIGTABLE_DIR=$(shell pwd)/gcloud/bigtable/_generated
DATASTORE_DIR=$(shell pwd)/gcloud/datastore/_generated
GRPC_PLUGIN=grpc_python_plugin
PROTOC_CMD=protoc
BIGTABLE_PROTOS_DIR=$(shell pwd)/cloud-bigtable-client/bigtable-protos/src/main/proto
GENERATED_SUBDIR=_generated
BIGTABLE_DIR=$(shell pwd)/gcloud/bigtable/$(GENERATED_SUBDIR)
PROTOC_CMD=$(GRPCIO_VIRTUALENV)/bin/python -m grpc.tools.protoc
GOOGLEAPIS_PROTOS_DIR=$(shell pwd)/googleapis-pb
BIGTABLE_CHECKOUT_DIR=$(shell pwd)/cloud-bigtable-client
BIGTABLE_PROTOS_DIR=$(BIGTABLE_CHECKOUT_DIR)/bigtable-client-core-parent/bigtable-protos/src/main/proto

help:
@echo 'Makefile for gcloud-python Bigtable protos '
Expand All @@ -14,19 +15,22 @@ help:
@echo ' make clean Clean generated files '

generate:
# Ensure we have a virtualenv w/ up-to-date grpcio/grpcio-tools
[ -d $(GRPCIO_VIRTUALENV) ] || python2.7 -m virtualenv $(GRPCIO_VIRTUALENV)
$(GRPCIO_VIRTUALENV)/bin/pip install --upgrade grpcio grpcio-tools
# Retrieve git repos that have our *.proto files.
[ -d cloud-bigtable-client ] || git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-client --depth=1
cd cloud-bigtable-client && git pull origin master
[ -d googleapis-pb ] || git clone https://github.com/google/googleapis googleapis-pb --depth=1
cd googleapis-pb && git pull origin master
[ -d $(BIGTABLE_CHECKOUT_DIR) ] || git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-client --depth=1
cd $(BIGTABLE_CHECKOUT_DIR) && git pull origin master
[ -d $(GOOGLEAPIS_PROTOS_DIR) ] || git clone https://github.com/google/googleapis googleapis-pb --depth=1
cd $(GOOGLEAPIS_PROTOS_DIR) && git pull origin master
# Make the directory where our *_pb2.py files will go.
mkdir -p $(GENERATED_DIR)
# Generate all *_pb2.py files that require gRPC.
$(PROTOC_CMD) \
--proto_path=$(BIGTABLE_PROTOS_DIR) \
--proto_path=$(GOOGLEAPIS_PROTOS_DIR) \
--python_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
--grpc_out=$(GENERATED_DIR) \
--grpc_python_out=$(GENERATED_DIR) \
$(BIGTABLE_PROTOS_DIR)/google/bigtable/v1/bigtable_service.proto \
$(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto \
$(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_service.proto
Expand All @@ -41,49 +45,37 @@ generate:
$(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto \
$(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_data.proto \
$(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/table/v1/bigtable_table_service_messages.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/datastore.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/entity.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/query.proto
# Move the newly generated *_pb2.py files into our library.
mv $(GENERATED_DIR)/google/bigtable/v1/* $(BIGTABLE_DIR)
mv $(GENERATED_DIR)/google/bigtable/admin/cluster/v1/* $(BIGTABLE_DIR)
mv $(GENERATED_DIR)/google/bigtable/admin/table/v1/* $(BIGTABLE_DIR)
mv $(GENERATED_DIR)/google/datastore/v1beta3/* $(DATASTORE_DIR)
cp $(GENERATED_DIR)/google/bigtable/v1/* $(BIGTABLE_DIR)
cp $(GENERATED_DIR)/google/bigtable/admin/cluster/v1/* $(BIGTABLE_DIR)
cp $(GENERATED_DIR)/google/bigtable/admin/table/v1/* $(BIGTABLE_DIR)
# Remove all existing *.proto files before we replace
rm -f $(BIGTABLE_DIR)/*.proto
rm -f $(DATASTORE_DIR)/*.proto
# Copy over the *.proto files into our library.
cp $(BIGTABLE_PROTOS_DIR)/google/bigtable/v1/*.proto $(BIGTABLE_DIR)
cp $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/cluster/v1/*.proto $(BIGTABLE_DIR)
cp $(BIGTABLE_PROTOS_DIR)/google/bigtable/admin/table/v1/*.proto $(BIGTABLE_DIR)
cp $(BIGTABLE_PROTOS_DIR)/google/longrunning/operations.proto $(BIGTABLE_DIR)
cp $(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/*.proto $(DATASTORE_DIR)
cp $(GOOGLEAPIS_PROTOS_DIR)/google/longrunning/operations.proto $(BIGTABLE_DIR)
# Rename all *.proto files in our library with an
# underscore and remove executable bit.
cd $(BIGTABLE_DIR) && \
for filename in *.proto; do \
chmod -x $$filename ; \
mv $$filename _$$filename ; \
done
cd $(DATASTORE_DIR) && \
for filename in *.proto; do \
chmod -x $$filename ; \
mv $$filename _$$filename ; \
done
# Separate the gRPC parts of the operations service from the
# non-gRPC parts so that the protos from `googleapis-common-protos`
# can be used without gRPC.
python scripts/make_operations_grpc.py
# Separate the gRPC parts of the datastore service from the
# non-gRPC parts so that the protos can be used without gRPC.
python scripts/make_datastore_grpc.py
GRPCIO_VIRTUALENV="$(GRPCIO_VIRTUALENV)" \
GENERATED_SUBDIR=$(GENERATED_SUBDIR) \
python scripts/make_operations_grpc.py
# Rewrite the imports in the generated *_pb2.py files.
python scripts/rewrite_imports.py
python scripts/rewrite_imports.py $(BIGTABLE_DIR)/*pb2.py

check_generate:
python scripts/check_generate.py

clean:
rm -fr cloud-bigtable-client $(GENERATED_DIR)
rm -fr $(GRPCIO_VIRTUALENV) $(GOOGLEAPIS_PROTOS_DIR) $(GENERATED_DIR)

.PHONY: generate check_generate clean
71 changes: 71 additions & 0 deletions Makefile.bigtable_v2
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
GRPCIO_VIRTUALENV=$(shell pwd)/grpc_python_venv
GENERATED_DIR=$(shell pwd)/generated_python
GENERATED_SUBDIR=_generated_v2
BIGTABLE_DIR=$(shell pwd)/gcloud/bigtable/$(GENERATED_SUBDIR)
PROTOC_CMD=$(GRPCIO_VIRTUALENV)/bin/python -m grpc.tools.protoc
GOOGLEAPIS_PROTOS_DIR=$(shell pwd)/googleapis-pb

help:
@echo 'Makefile for gcloud-python Bigtable protos '
@echo ' '
@echo ' make generate Generates the protobuf modules '
@echo ' make check_generate Checks that generate succeeded '
@echo ' make clean Clean generated files '

generate:
# Ensure we have a virtualenv w/ up-to-date grpcio/grpcio-tools
[ -d $(GRPCIO_VIRTUALENV) ] || python2.7 -m virtualenv $(GRPCIO_VIRTUALENV)
$(GRPCIO_VIRTUALENV)/bin/pip install --upgrade grpcio grpcio-tools
# Retrieve git repos that have our *.proto files.
[ -d googleapis-pb ] || git clone https://github.com/google/googleapis googleapis-pb --depth=1
cd googleapis-pb && git pull origin master
# Make the directory where our *_pb2.py files will go.
mkdir -p $(GENERATED_DIR)
# Generate all *_pb2.py files that require gRPC.
$(PROTOC_CMD) \
--proto_path=$(GOOGLEAPIS_PROTOS_DIR) \
--python_out=$(GENERATED_DIR) \
--grpc_python_out=$(GENERATED_DIR) \
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/v2/bigtable.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/bigtable_instance_admin.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/bigtable_table_admin.proto
# Generate all *_pb2.py files that do not require gRPC.
$(PROTOC_CMD) \
--proto_path=$(GOOGLEAPIS_PROTOS_DIR) \
--python_out=$(GENERATED_DIR) \
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/v2/data.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/common.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/instance.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/table.proto \
# Move the newly generated *_pb2.py files into our library.
cp $(GENERATED_DIR)/google/bigtable/v2/* $(BIGTABLE_DIR)
cp $(GENERATED_DIR)/google/bigtable/admin/v2/* $(BIGTABLE_DIR)
# Remove all existing *.proto files before we replace
rm -f $(BIGTABLE_DIR)/*.proto
# Copy over the *.proto files into our library.
cp $(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/v2/*.proto $(BIGTABLE_DIR)
cp $(GOOGLEAPIS_PROTOS_DIR)/google/bigtable/admin/v2/*.proto $(BIGTABLE_DIR)
cp $(GOOGLEAPIS_PROTOS_DIR)/google/longrunning/operations.proto $(BIGTABLE_DIR)
# Rename all *.proto files in our library with an
# underscore and remove executable bit.
cd $(BIGTABLE_DIR) && \
for filename in *.proto; do \
chmod -x $$filename ; \
mv $$filename _$$filename ; \
done
# Separate the gRPC parts of the operations service from the
# non-gRPC parts so that the protos from `googleapis-common-protos`
# can be used without gRPC.
GRPCIO_VIRTUALENV="$(GRPCIO_VIRTUALENV)" \
GENERATED_SUBDIR=$(GENERATED_SUBDIR) \
python scripts/make_operations_grpc.py
# Rewrite the imports in the generated *_pb2.py files.
python scripts/rewrite_imports.py $(BIGTABLE_DIR)/*pb2.py

check_generate:
python scripts/check_generate.py

clean:
rm -fr $(GRPCIO_VIRTUALENV) $(GOOGLEAPIS_PROTOS_DIR) $(GENERATED_DIR)

.PHONY: generate check_generate clean
57 changes: 57 additions & 0 deletions Makefile.datastore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
GRPCIO_VIRTUALENV=$(shell pwd)/grpc_python_venv
GENERATED_DIR=$(shell pwd)/generated_python
DATASTORE_DIR=$(shell pwd)/gcloud/datastore/_generated
PROTOC_CMD=$(GRPCIO_VIRTUALENV)/bin/python -m grpc.tools.protoc
GOOGLEAPIS_PROTOS_DIR=$(shell pwd)/googleapis-pb

help:
@echo 'Makefile for gcloud-python Bigtable protos '
@echo ' '
@echo ' make generate Generates the protobuf modules '
@echo ' make check_generate Checks that generate succeeded '
@echo ' make clean Clean generated files '

generate:
# Ensure we have a virtualenv w/ up-to-date grpcio/grpcio-tools
[ -d $(GRPCIO_VIRTUALENV) ] || python2.7 -m virtualenv $(GRPCIO_VIRTUALENV)
$(GRPCIO_VIRTUALENV)/bin/pip install --upgrade grpcio grpcio-tools
# Retrieve git repos that have our *.proto files.
[ -d googleapis-pb ] || git clone https://github.com/google/googleapis googleapis-pb --depth=1
cd googleapis-pb && git pull origin master
# Make the directory where our *_pb2.py files will go.
mkdir -p $(GENERATED_DIR)
# Generate all *_pb2.py files that do not require gRPC.
$(PROTOC_CMD) \
--proto_path=$(GOOGLEAPIS_PROTOS_DIR) \
--python_out=$(GENERATED_DIR) \
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/datastore.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/entity.proto \
$(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/query.proto
# Move the newly generated *_pb2.py files into our library.
cp $(GENERATED_DIR)/google/datastore/v1beta3/* $(DATASTORE_DIR)
# Remove all existing *.proto files before we replace
rm -f $(DATASTORE_DIR)/*.proto
# Copy over the *.proto files into our library.
cp $(GOOGLEAPIS_PROTOS_DIR)/google/datastore/v1beta3/*.proto $(DATASTORE_DIR)
# Rename all *.proto files in our library with an
# underscore and remove executable bit.
cd $(DATASTORE_DIR) && \
for filename in *.proto; do \
chmod -x $$filename ; \
mv $$filename _$$filename ; \
done
# Separate the gRPC parts of the datastore service from the
# non-gRPC parts so that the protos can be used without gRPC.
GRPCIO_VIRTUALENV="$(GRPCIO_VIRTUALENV)" \
GENERATED_SUBDIR=$(GENERATED_SUBDIR) \
python scripts/make_datastore_grpc.py
# Rewrite the imports in the generated *_pb2.py files.
python scripts/rewrite_imports.py $(DATASTORE_DIR)/*pb2.py

check_generate:
python scripts/check_generate.py

clean:
rm -fr $(GENERATED_DIR)

.PHONY: generate check_generate clean
74 changes: 74 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ This client supports the following Google Cloud Platform services:
- `Google Cloud Pub/Sub`_
- `Google BigQuery`_
- `Google Cloud Resource Manager`_
- `Google Stackdriver Logging`_

.. _Google Cloud Datastore: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-datastore
.. _Google Cloud Storage: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-storage
.. _Google Cloud Pub/Sub: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-pubsub
.. _Google BigQuery: https://github.com/GoogleCloudPlatform/gcloud-python#google-bigquery
.. _Google Cloud Resource Manager: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-resource-manager
.. _Google Stackdriver Logging: https://github.com/GoogleCloudPlatform/gcloud-python#google-cloud-logging

If you need support for other Google APIs, check out the
`Google APIs Python Client library`_.
Expand Down Expand Up @@ -174,6 +176,49 @@ append-only tables, using the processing power of Google's infrastructure.

This package is still being implemented, but it is almost complete!

Load data from CSV
~~~~~~~~~~~~~~~~~~

.. code:: python

import csv

from gcloud import bigquery
from gcloud.bigquery import SchemaField

client = bigquery.Client()

dataset = client.dataset('dataset_name')
dataset.create() # API request

SCHEMA = [
SchemaField('full_name', 'STRING', mode='required'),
SchemaField('age', 'INTEGER', mode='required'),
]
table = dataset.table('table_name', SCHEMA)
table.create()

with open('csv_file', 'rb') as readable:
table.upload_from_file(
readable, source_format='CSV', skip_leading_rows=1)

Perform a synchronous query
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

# Perform a synchronous query.
QUERY = (
'SELECT name FROM [bigquery-public-data:usa_names.usa_1910_2013] '
'WHERE state = "TX"')
query = client.run_sync_query('%s LIMIT 100' % QUERY)
query.timeout_ms = TIMEOUT_MS
query.run()

for row in query.rows:
print row


See the ``gcloud-python`` API `BigQuery documentation`_ to learn how to connect
to BigQuery using this Client Library.

Expand All @@ -194,6 +239,35 @@ manage projects using this Client Library.

.. _Resource Manager documentation: https://googlecloudplatform.github.io/gcloud-python/stable/resource-manager-api.html

Google Stackdriver Logging
--------------------------

`Stackdriver Logging`_ API (`Logging API docs`_) allows you to store, search,
analyze, monitor, and alert on log data and events from Google Cloud Platform.

.. _Stackdriver Logging: https://cloud.google.com/logging/
.. _Logging API docs: https://cloud.google.com/logging/docs/

.. code:: python

from gcloud import logging
client = logging.Client()
logger = client.logger('log_name')
logger.log_text("A simple entry") # API call

Example of fetching entries:

.. code:: python

entries, token = logger.list_entries()
for entry in entries:
print entry.payload

See the ``gcloud-python`` API `logging documentation`_ to learn how to connect
to Stackdriver Logging using this Client Library.

.. _logging documentation: https://googlecloudplatform.github.io/gcloud-python/stable/logging-usage.html

Contributing
------------

Expand Down
Loading