@@ -56,26 +56,26 @@ def run_table_operations(project_id, instance_id, table_id):
5656
5757 # Check whether table exists in an instance.
5858 # Create table if it does not exists.
59- print 'Checking if table {} exists...' .format (table_id )
59+ print ( 'Checking if table {} exists...' .format (table_id ) )
6060 if table .exists ():
61- print 'Table {} already exists.' .format (table_id )
61+ print ( 'Table {} already exists.' .format (table_id ) )
6262 else :
63- print 'Creating the {} table.' .format (table_id )
63+ print ( 'Creating the {} table.' .format (table_id ) )
6464 table .create ()
65- print 'Created table {}.' .format (table_id )
65+ print ( 'Created table {}.' .format (table_id ) )
6666
6767 # [START bigtable_list_tables]
6868 tables = instance .list_tables ()
69- print 'Listing tables in current project...'
69+ print ( 'Listing tables in current project...' )
7070 if tables != []:
7171 for tbl in tables :
72- print tbl .table_id
72+ print ( tbl .table_id )
7373 else :
74- print 'No table exists in current project...'
74+ print ( 'No table exists in current project...' )
7575 # [END bigtable_list_tables]
7676
7777 # [START bigtable_create_family_gc_max_age]
78- print 'Creating column family cf1 with with MaxAge GC Rule...'
78+ print ( 'Creating column family cf1 with with MaxAge GC Rule...' )
7979 # Create a column family with GC policy : maximum age
8080 # where age = current time minus cell timestamp
8181
@@ -84,11 +84,11 @@ def run_table_operations(project_id, instance_id, table_id):
8484
8585 column_family1 = table .column_family ('cf1' , max_age_rule )
8686 column_family1 .create ()
87- print 'Created column family cf1 with MaxAge GC Rule.'
87+ print ( 'Created column family cf1 with MaxAge GC Rule.' )
8888 # [END bigtable_create_family_gc_max_age]
8989
9090 # [START bigtable_create_family_gc_max_versions]
91- print 'Creating column family cf2 with max versions GC rule...'
91+ print ( 'Creating column family cf2 with max versions GC rule...' )
9292 # Create a column family with GC policy : most recent N versions
9393 # where 1 = most recent version
9494
@@ -97,11 +97,11 @@ def run_table_operations(project_id, instance_id, table_id):
9797
9898 column_family2 = table .column_family ('cf2' , max_versions_rule )
9999 column_family2 .create ()
100- print 'Created column family cf2 with Max Versions GC Rule.'
100+ print ( 'Created column family cf2 with Max Versions GC Rule.' )
101101 # [END bigtable_create_family_gc_max_versions]
102102
103103 # [START bigtable_create_family_gc_union]
104- print 'Creating column family cf3 with union GC rule...'
104+ print ( 'Creating column family cf3 with union GC rule...' )
105105 # Create a column family with GC policy to drop data that matches
106106 # at least one condition.
107107 # Define a GC rule to drop cells older than 5 days or not the
@@ -112,11 +112,11 @@ def run_table_operations(project_id, instance_id, table_id):
112112
113113 column_family3 = table .column_family ('cf3' , union_rule )
114114 column_family3 .create ()
115- print 'Created column family cf3 with Union GC rule'
115+ print ( 'Created column family cf3 with Union GC rule' )
116116 # [END bigtable_create_family_gc_union]
117117
118118 # [START bigtable_create_family_gc_intersection]
119- print 'Creating column family cf4 with Intersection GC rule...'
119+ print ( 'Creating column family cf4 with Intersection GC rule...' )
120120 # Create a column family with GC policy to drop data that matches
121121 # all conditions
122122 # GC rule: Drop cells older than 5 days AND older than the most
@@ -127,11 +127,11 @@ def run_table_operations(project_id, instance_id, table_id):
127127
128128 column_family4 = table .column_family ('cf4' , intersection_rule )
129129 column_family4 .create ()
130- print 'Created column family cf4 with Intersection GC rule.'
130+ print ( 'Created column family cf4 with Intersection GC rule.' )
131131 # [END bigtable_create_family_gc_intersection]
132132
133133 # [START bigtable_create_family_gc_nested]
134- print 'Creating column family cf5 with a Nested GC rule...'
134+ print ( 'Creating column family cf5 with a Nested GC rule...' )
135135 # Create a column family with nested GC policies.
136136 # Create a nested GC rule:
137137 # Drop cells that are either older than the 10 recent versions
@@ -147,16 +147,16 @@ def run_table_operations(project_id, instance_id, table_id):
147147
148148 column_family5 = table .column_family ('cf5' , nested_rule )
149149 column_family5 .create ()
150- print 'Created column family cf5 with a Nested GC rule.'
150+ print ( 'Created column family cf5 with a Nested GC rule.' )
151151 # [END bigtable_create_family_gc_nested]
152152
153153 # [START bigtable_list_column_families]
154- print 'Printing Column Family and GC Rule for all column families...'
154+ print ( 'Printing Column Family and GC Rule for all column families...' )
155155 column_families = table .list_column_families ()
156156 for column_family_name , gc_rule in sorted (column_families .items ()):
157- print 'Column Family:' , column_family_name
158- print 'GC Rule:'
159- print gc_rule .to_pb ()
157+ print ( 'Column Family:' , column_family_name )
158+ print ( 'GC Rule:' )
159+ print ( gc_rule .to_pb () )
160160 # Sample output:
161161 # Column Family: cf4
162162 # GC Rule:
@@ -174,33 +174,33 @@ def run_table_operations(project_id, instance_id, table_id):
174174 # }
175175 # [END bigtable_list_column_families]
176176
177- print 'Print column family cf1 GC rule before update...'
178- print 'Column Family: cf1'
179- print column_family1 .to_pb ()
177+ print ( 'Print column family cf1 GC rule before update...' )
178+ print ( 'Column Family: cf1' )
179+ print ( column_family1 .to_pb () )
180180
181181 # [START bigtable_update_gc_rule]
182- print 'Updating column family cf1 GC rule...'
182+ print ( 'Updating column family cf1 GC rule...' )
183183 # Update the column family cf1 to update the GC rule
184184 column_family1 = table .column_family (
185185 'cf1' ,
186186 column_family .MaxVersionsGCRule (1 ))
187187 column_family1 .update ()
188- print 'Updated column family cf1 GC rule\n '
188+ print ( 'Updated column family cf1 GC rule\n ' )
189189 # [END bigtable_update_gc_rule]
190190
191- print 'Print column family cf1 GC rule after update...'
192- print 'Column Family: cf1'
193- print column_family1 .to_pb ()
191+ print ( 'Print column family cf1 GC rule after update...' )
192+ print ( 'Column Family: cf1' )
193+ print ( column_family1 .to_pb () )
194194
195195 # [START bigtable_delete_family]
196- print 'Delete a column family cf2...'
196+ print ( 'Delete a column family cf2...' )
197197 # Delete a column family
198198 column_family2 .delete ()
199- print 'Column family cf2 deleted successfully.'
199+ print ( 'Column family cf2 deleted successfully.' )
200200 # [END bigtable_delete_family]
201201
202- print 'execute command "python tableadmin.py delete [project_id] \
203- [instance_id] --table [tableName]" to delete the table.'
202+ print ( 'execute command "python tableadmin.py delete [project_id] \
203+ [instance_id] --table [tableName]" to delete the table.')
204204
205205
206206def delete_table (project_id , instance_id , table_id ):
@@ -223,14 +223,14 @@ def delete_table(project_id, instance_id, table_id):
223223 # [START bigtable_delete_table]
224224 # Delete the entire table
225225
226- print 'Checking if table {} exists...' .format (table_id )
226+ print ( 'Checking if table {} exists...' .format (table_id ) )
227227 if table .exists ():
228- print 'Table {} exists.' .format (table_id )
229- print 'Deleting {} table.' .format (table_id )
228+ print ( 'Table {} exists.' .format (table_id ) )
229+ print ( 'Deleting {} table.' .format (table_id ) )
230230 table .delete ()
231- print 'Deleted {} table.' .format (table_id )
231+ print ( 'Deleted {} table.' .format (table_id ) )
232232 else :
233- print 'Table {} does not exists.' .format (table_id )
233+ print ( 'Table {} does not exists.' .format (table_id ) )
234234 # [END bigtable_delete_table]
235235
236236
@@ -261,5 +261,5 @@ def delete_table(project_id, instance_id, table_id):
261261 elif args .command .lower () == 'delete' :
262262 delete_table (args .project_id , args .instance_id , args .table )
263263 else :
264- print 'Command should be either run or delete.\n Use argument -h,\
265- --help to show help and exit.'
264+ print ( 'Command should be either run or delete.\n Use argument -h,\
265+ --help to show help and exit.')
0 commit comments