PageRenderTime 24ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.0.0-rc0/hive/external/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote

#
#! | 477 lines | 409 code | 68 blank | 0 comment | 0 complexity | ac8c55e8b24d9e89264715c9bb1c3a7a MD5 | raw file
  1#!/usr/bin/env python
  2#
  3# Autogenerated by Thrift
  4#
  5# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  6#
  7
  8import sys
  9import pprint
 10from urlparse import urlparse
 11from thrift.transport import TTransport
 12from thrift.transport import TSocket
 13from thrift.transport import THttpClient
 14from thrift.protocol import TBinaryProtocol
 15
 16import ThriftHiveMetastore
 17from ttypes import *
 18
 19if len(sys.argv) <= 1 or sys.argv[1] == '--help':
 20  print ''
 21  print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
 22  print ''
 23  print 'Functions:'
 24  print '  void create_database(Database database)'
 25  print '  Database get_database(string name)'
 26  print '  void drop_database(string name, bool deleteData)'
 27  print '   get_databases(string pattern)'
 28  print '   get_all_databases()'
 29  print '  void alter_database(string dbname, Database db)'
 30  print '  Type get_type(string name)'
 31  print '  bool create_type(Type type)'
 32  print '  bool drop_type(string type)'
 33  print '   get_type_all(string name)'
 34  print '   get_fields(string db_name, string table_name)'
 35  print '   get_schema(string db_name, string table_name)'
 36  print '  void create_table(Table tbl)'
 37  print '  void drop_table(string dbname, string name, bool deleteData)'
 38  print '   get_tables(string db_name, string pattern)'
 39  print '   get_all_tables(string db_name)'
 40  print '  Table get_table(string dbname, string tbl_name)'
 41  print '  void alter_table(string dbname, string tbl_name, Table new_tbl)'
 42  print '  Partition add_partition(Partition new_part)'
 43  print '  Partition append_partition(string db_name, string tbl_name,  part_vals)'
 44  print '  Partition append_partition_by_name(string db_name, string tbl_name, string part_name)'
 45  print '  bool drop_partition(string db_name, string tbl_name,  part_vals, bool deleteData)'
 46  print '  bool drop_partition_by_name(string db_name, string tbl_name, string part_name, bool deleteData)'
 47  print '  Partition get_partition(string db_name, string tbl_name,  part_vals)'
 48  print '  Partition get_partition_with_auth(string db_name, string tbl_name,  part_vals, string user_name,  group_names)'
 49  print '  Partition get_partition_by_name(string db_name, string tbl_name, string part_name)'
 50  print '   get_partitions(string db_name, string tbl_name, i16 max_parts)'
 51  print '   get_partitions_with_auth(string db_name, string tbl_name, i16 max_parts, string user_name,  group_names)'
 52  print '   get_partition_names(string db_name, string tbl_name, i16 max_parts)'
 53  print '   get_partitions_ps(string db_name, string tbl_name,  part_vals, i16 max_parts)'
 54  print '   get_partitions_ps_with_auth(string db_name, string tbl_name,  part_vals, i16 max_parts, string user_name,  group_names)'
 55  print '   get_partition_names_ps(string db_name, string tbl_name,  part_vals, i16 max_parts)'
 56  print '   get_partitions_by_filter(string db_name, string tbl_name, string filter, i16 max_parts)'
 57  print '  void alter_partition(string db_name, string tbl_name, Partition new_part)'
 58  print '  string get_config_value(string name, string defaultValue)'
 59  print '   partition_name_to_vals(string part_name)'
 60  print '   partition_name_to_spec(string part_name)'
 61  print '  Index add_index(Index new_index, Table index_table)'
 62  print '  void alter_index(string dbname, string base_tbl_name, string idx_name, Index new_idx)'
 63  print '  bool drop_index_by_name(string db_name, string tbl_name, string index_name, bool deleteData)'
 64  print '  Index get_index_by_name(string db_name, string tbl_name, string index_name)'
 65  print '   get_indexes(string db_name, string tbl_name, i16 max_indexes)'
 66  print '   get_index_names(string db_name, string tbl_name, i16 max_indexes)'
 67  print '  bool create_role(Role role)'
 68  print '  bool drop_role(string role_name)'
 69  print '   get_role_names()'
 70  print '  bool grant_role(string role_name, string principal_name, PrincipalType principal_type, string grantor, PrincipalType grantorType, bool grant_option)'
 71  print '  bool revoke_role(string role_name, string principal_name, PrincipalType principal_type)'
 72  print '   list_roles(string principal_name, PrincipalType principal_type)'
 73  print '  PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, string user_name,  group_names)'
 74  print '   list_privileges(string principal_name, PrincipalType principal_type, HiveObjectRef hiveObject)'
 75  print '  bool grant_privileges(PrivilegeBag privileges)'
 76  print '  bool revoke_privileges(PrivilegeBag privileges)'
 77  print '  string get_delegation_token(string renewer_kerberos_principal_name)'
 78  print '  string get_delegation_token_with_signature(string renewer_kerberos_principal_name, string token_signature)'
 79  print '  i64 renew_delegation_token(string token_str_form)'
 80  print '  void cancel_delegation_token(string token_str_form)'
 81  print ''
 82  sys.exit(0)
 83
 84pp = pprint.PrettyPrinter(indent = 2)
 85host = 'localhost'
 86port = 9090
 87uri = ''
 88framed = False
 89http = False
 90argi = 1
 91
 92if sys.argv[argi] == '-h':
 93  parts = sys.argv[argi+1].split(':')
 94  host = parts[0]
 95  port = int(parts[1])
 96  argi += 2
 97
 98if sys.argv[argi] == '-u':
 99  url = urlparse(sys.argv[argi+1])
100  parts = url[1].split(':')
101  host = parts[0]
102  if len(parts) > 1:
103    port = int(parts[1])
104  else:
105    port = 80
106  uri = url[2]
107  if url[4]:
108    uri += '?%s' % url[4]
109  http = True
110  argi += 2
111
112if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
113  framed = True
114  argi += 1
115
116cmd = sys.argv[argi]
117args = sys.argv[argi+1:]
118
119if http:
120  transport = THttpClient.THttpClient(host, port, uri)
121else:
122  socket = TSocket.TSocket(host, port)
123  if framed:
124    transport = TTransport.TFramedTransport(socket)
125  else:
126    transport = TTransport.TBufferedTransport(socket)
127protocol = TBinaryProtocol.TBinaryProtocol(transport)
128client = ThriftHiveMetastore.Client(protocol)
129transport.open()
130
131if cmd == 'create_database':
132  if len(args) != 1:
133    print 'create_database requires 1 args'
134    sys.exit(1)
135  pp.pprint(client.create_database(eval(args[0]),))
136
137elif cmd == 'get_database':
138  if len(args) != 1:
139    print 'get_database requires 1 args'
140    sys.exit(1)
141  pp.pprint(client.get_database(args[0],))
142
143elif cmd == 'drop_database':
144  if len(args) != 2:
145    print 'drop_database requires 2 args'
146    sys.exit(1)
147  pp.pprint(client.drop_database(args[0],eval(args[1]),))
148
149elif cmd == 'get_databases':
150  if len(args) != 1:
151    print 'get_databases requires 1 args'
152    sys.exit(1)
153  pp.pprint(client.get_databases(args[0],))
154
155elif cmd == 'get_all_databases':
156  if len(args) != 0:
157    print 'get_all_databases requires 0 args'
158    sys.exit(1)
159  pp.pprint(client.get_all_databases())
160
161elif cmd == 'alter_database':
162  if len(args) != 2:
163    print 'alter_database requires 2 args'
164    sys.exit(1)
165  pp.pprint(client.alter_database(args[0],eval(args[1]),))
166
167elif cmd == 'get_type':
168  if len(args) != 1:
169    print 'get_type requires 1 args'
170    sys.exit(1)
171  pp.pprint(client.get_type(args[0],))
172
173elif cmd == 'create_type':
174  if len(args) != 1:
175    print 'create_type requires 1 args'
176    sys.exit(1)
177  pp.pprint(client.create_type(eval(args[0]),))
178
179elif cmd == 'drop_type':
180  if len(args) != 1:
181    print 'drop_type requires 1 args'
182    sys.exit(1)
183  pp.pprint(client.drop_type(args[0],))
184
185elif cmd == 'get_type_all':
186  if len(args) != 1:
187    print 'get_type_all requires 1 args'
188    sys.exit(1)
189  pp.pprint(client.get_type_all(args[0],))
190
191elif cmd == 'get_fields':
192  if len(args) != 2:
193    print 'get_fields requires 2 args'
194    sys.exit(1)
195  pp.pprint(client.get_fields(args[0],args[1],))
196
197elif cmd == 'get_schema':
198  if len(args) != 2:
199    print 'get_schema requires 2 args'
200    sys.exit(1)
201  pp.pprint(client.get_schema(args[0],args[1],))
202
203elif cmd == 'create_table':
204  if len(args) != 1:
205    print 'create_table requires 1 args'
206    sys.exit(1)
207  pp.pprint(client.create_table(eval(args[0]),))
208
209elif cmd == 'drop_table':
210  if len(args) != 3:
211    print 'drop_table requires 3 args'
212    sys.exit(1)
213  pp.pprint(client.drop_table(args[0],args[1],eval(args[2]),))
214
215elif cmd == 'get_tables':
216  if len(args) != 2:
217    print 'get_tables requires 2 args'
218    sys.exit(1)
219  pp.pprint(client.get_tables(args[0],args[1],))
220
221elif cmd == 'get_all_tables':
222  if len(args) != 1:
223    print 'get_all_tables requires 1 args'
224    sys.exit(1)
225  pp.pprint(client.get_all_tables(args[0],))
226
227elif cmd == 'get_table':
228  if len(args) != 2:
229    print 'get_table requires 2 args'
230    sys.exit(1)
231  pp.pprint(client.get_table(args[0],args[1],))
232
233elif cmd == 'alter_table':
234  if len(args) != 3:
235    print 'alter_table requires 3 args'
236    sys.exit(1)
237  pp.pprint(client.alter_table(args[0],args[1],eval(args[2]),))
238
239elif cmd == 'add_partition':
240  if len(args) != 1:
241    print 'add_partition requires 1 args'
242    sys.exit(1)
243  pp.pprint(client.add_partition(eval(args[0]),))
244
245elif cmd == 'append_partition':
246  if len(args) != 3:
247    print 'append_partition requires 3 args'
248    sys.exit(1)
249  pp.pprint(client.append_partition(args[0],args[1],eval(args[2]),))
250
251elif cmd == 'append_partition_by_name':
252  if len(args) != 3:
253    print 'append_partition_by_name requires 3 args'
254    sys.exit(1)
255  pp.pprint(client.append_partition_by_name(args[0],args[1],args[2],))
256
257elif cmd == 'drop_partition':
258  if len(args) != 4:
259    print 'drop_partition requires 4 args'
260    sys.exit(1)
261  pp.pprint(client.drop_partition(args[0],args[1],eval(args[2]),eval(args[3]),))
262
263elif cmd == 'drop_partition_by_name':
264  if len(args) != 4:
265    print 'drop_partition_by_name requires 4 args'
266    sys.exit(1)
267  pp.pprint(client.drop_partition_by_name(args[0],args[1],args[2],eval(args[3]),))
268
269elif cmd == 'get_partition':
270  if len(args) != 3:
271    print 'get_partition requires 3 args'
272    sys.exit(1)
273  pp.pprint(client.get_partition(args[0],args[1],eval(args[2]),))
274
275elif cmd == 'get_partition_with_auth':
276  if len(args) != 5:
277    print 'get_partition_with_auth requires 5 args'
278    sys.exit(1)
279  pp.pprint(client.get_partition_with_auth(args[0],args[1],eval(args[2]),args[3],eval(args[4]),))
280
281elif cmd == 'get_partition_by_name':
282  if len(args) != 3:
283    print 'get_partition_by_name requires 3 args'
284    sys.exit(1)
285  pp.pprint(client.get_partition_by_name(args[0],args[1],args[2],))
286
287elif cmd == 'get_partitions':
288  if len(args) != 3:
289    print 'get_partitions requires 3 args'
290    sys.exit(1)
291  pp.pprint(client.get_partitions(args[0],args[1],eval(args[2]),))
292
293elif cmd == 'get_partitions_with_auth':
294  if len(args) != 5:
295    print 'get_partitions_with_auth requires 5 args'
296    sys.exit(1)
297  pp.pprint(client.get_partitions_with_auth(args[0],args[1],eval(args[2]),args[3],eval(args[4]),))
298
299elif cmd == 'get_partition_names':
300  if len(args) != 3:
301    print 'get_partition_names requires 3 args'
302    sys.exit(1)
303  pp.pprint(client.get_partition_names(args[0],args[1],eval(args[2]),))
304
305elif cmd == 'get_partitions_ps':
306  if len(args) != 4:
307    print 'get_partitions_ps requires 4 args'
308    sys.exit(1)
309  pp.pprint(client.get_partitions_ps(args[0],args[1],eval(args[2]),eval(args[3]),))
310
311elif cmd == 'get_partitions_ps_with_auth':
312  if len(args) != 6:
313    print 'get_partitions_ps_with_auth requires 6 args'
314    sys.exit(1)
315  pp.pprint(client.get_partitions_ps_with_auth(args[0],args[1],eval(args[2]),eval(args[3]),args[4],eval(args[5]),))
316
317elif cmd == 'get_partition_names_ps':
318  if len(args) != 4:
319    print 'get_partition_names_ps requires 4 args'
320    sys.exit(1)
321  pp.pprint(client.get_partition_names_ps(args[0],args[1],eval(args[2]),eval(args[3]),))
322
323elif cmd == 'get_partitions_by_filter':
324  if len(args) != 4:
325    print 'get_partitions_by_filter requires 4 args'
326    sys.exit(1)
327  pp.pprint(client.get_partitions_by_filter(args[0],args[1],args[2],eval(args[3]),))
328
329elif cmd == 'alter_partition':
330  if len(args) != 3:
331    print 'alter_partition requires 3 args'
332    sys.exit(1)
333  pp.pprint(client.alter_partition(args[0],args[1],eval(args[2]),))
334
335elif cmd == 'get_config_value':
336  if len(args) != 2:
337    print 'get_config_value requires 2 args'
338    sys.exit(1)
339  pp.pprint(client.get_config_value(args[0],args[1],))
340
341elif cmd == 'partition_name_to_vals':
342  if len(args) != 1:
343    print 'partition_name_to_vals requires 1 args'
344    sys.exit(1)
345  pp.pprint(client.partition_name_to_vals(args[0],))
346
347elif cmd == 'partition_name_to_spec':
348  if len(args) != 1:
349    print 'partition_name_to_spec requires 1 args'
350    sys.exit(1)
351  pp.pprint(client.partition_name_to_spec(args[0],))
352
353elif cmd == 'add_index':
354  if len(args) != 2:
355    print 'add_index requires 2 args'
356    sys.exit(1)
357  pp.pprint(client.add_index(eval(args[0]),eval(args[1]),))
358
359elif cmd == 'alter_index':
360  if len(args) != 4:
361    print 'alter_index requires 4 args'
362    sys.exit(1)
363  pp.pprint(client.alter_index(args[0],args[1],args[2],eval(args[3]),))
364
365elif cmd == 'drop_index_by_name':
366  if len(args) != 4:
367    print 'drop_index_by_name requires 4 args'
368    sys.exit(1)
369  pp.pprint(client.drop_index_by_name(args[0],args[1],args[2],eval(args[3]),))
370
371elif cmd == 'get_index_by_name':
372  if len(args) != 3:
373    print 'get_index_by_name requires 3 args'
374    sys.exit(1)
375  pp.pprint(client.get_index_by_name(args[0],args[1],args[2],))
376
377elif cmd == 'get_indexes':
378  if len(args) != 3:
379    print 'get_indexes requires 3 args'
380    sys.exit(1)
381  pp.pprint(client.get_indexes(args[0],args[1],eval(args[2]),))
382
383elif cmd == 'get_index_names':
384  if len(args) != 3:
385    print 'get_index_names requires 3 args'
386    sys.exit(1)
387  pp.pprint(client.get_index_names(args[0],args[1],eval(args[2]),))
388
389elif cmd == 'create_role':
390  if len(args) != 1:
391    print 'create_role requires 1 args'
392    sys.exit(1)
393  pp.pprint(client.create_role(eval(args[0]),))
394
395elif cmd == 'drop_role':
396  if len(args) != 1:
397    print 'drop_role requires 1 args'
398    sys.exit(1)
399  pp.pprint(client.drop_role(args[0],))
400
401elif cmd == 'get_role_names':
402  if len(args) != 0:
403    print 'get_role_names requires 0 args'
404    sys.exit(1)
405  pp.pprint(client.get_role_names())
406
407elif cmd == 'grant_role':
408  if len(args) != 6:
409    print 'grant_role requires 6 args'
410    sys.exit(1)
411  pp.pprint(client.grant_role(args[0],args[1],eval(args[2]),args[3],eval(args[4]),eval(args[5]),))
412
413elif cmd == 'revoke_role':
414  if len(args) != 3:
415    print 'revoke_role requires 3 args'
416    sys.exit(1)
417  pp.pprint(client.revoke_role(args[0],args[1],eval(args[2]),))
418
419elif cmd == 'list_roles':
420  if len(args) != 2:
421    print 'list_roles requires 2 args'
422    sys.exit(1)
423  pp.pprint(client.list_roles(args[0],eval(args[1]),))
424
425elif cmd == 'get_privilege_set':
426  if len(args) != 3:
427    print 'get_privilege_set requires 3 args'
428    sys.exit(1)
429  pp.pprint(client.get_privilege_set(eval(args[0]),args[1],eval(args[2]),))
430
431elif cmd == 'list_privileges':
432  if len(args) != 3:
433    print 'list_privileges requires 3 args'
434    sys.exit(1)
435  pp.pprint(client.list_privileges(args[0],eval(args[1]),eval(args[2]),))
436
437elif cmd == 'grant_privileges':
438  if len(args) != 1:
439    print 'grant_privileges requires 1 args'
440    sys.exit(1)
441  pp.pprint(client.grant_privileges(eval(args[0]),))
442
443elif cmd == 'revoke_privileges':
444  if len(args) != 1:
445    print 'revoke_privileges requires 1 args'
446    sys.exit(1)
447  pp.pprint(client.revoke_privileges(eval(args[0]),))
448
449elif cmd == 'get_delegation_token':
450  if len(args) != 1:
451    print 'get_delegation_token requires 1 args'
452    sys.exit(1)
453  pp.pprint(client.get_delegation_token(args[0],))
454
455elif cmd == 'get_delegation_token_with_signature':
456  if len(args) != 2:
457    print 'get_delegation_token_with_signature requires 2 args'
458    sys.exit(1)
459  pp.pprint(client.get_delegation_token_with_signature(args[0],args[1],))
460
461elif cmd == 'renew_delegation_token':
462  if len(args) != 1:
463    print 'renew_delegation_token requires 1 args'
464    sys.exit(1)
465  pp.pprint(client.renew_delegation_token(args[0],))
466
467elif cmd == 'cancel_delegation_token':
468  if len(args) != 1:
469    print 'cancel_delegation_token requires 1 args'
470    sys.exit(1)
471  pp.pprint(client.cancel_delegation_token(args[0],))
472
473else:
474  print 'Unrecognized method %s' % cmd
475  sys.exit(1)
476
477transport.close()