MCPcopy Create free account
hub / github.com/apache/impala / _write

Method _write

tests/comparison/model_translator.py:470–492  ·  view source on GitHub ↗

Return a sql string representation of the given object.

(self, object_)

Source from the content-addressed store, hash-verified

468 for values_row in values_clause.values_rows]))
469
470 def _write(self, object_):
471 '''Return a sql string representation of the given object.'''
472 # What's below is effectively a giant switch statement. It works based on a func
473 # naming and signature convention. It should match the incoming object with the
474 # corresponding func defined, then call the func and return the result.
475 #
476 # Ex:
477 # a = model.And(...)
478 # _write(a) should call _write_func(a) because "And" is a subclass of "Func" and no
479 # other _writer_<class name> methods have been defined higher up the method
480 # resolution order (MRO). If _write_and(...) were to be defined, it would be called
481 # instead.
482 for type_ in getmro(type(object_)):
483 writer_func_name = '_write_' + self._to_py_name(type_.__name__)
484 writer_func = getattr(self, writer_func_name, None)
485 if writer_func:
486 return writer_func(object_)
487
488 # Handle any remaining cases
489 if isinstance(object_, Query):
490 return self.write_query(object_)
491
492 raise Exception('Unsupported object: %s<%s>' % (type(object_).__name__, object_))
493
494 def get_nulls_order(self, order):
495 if self.nulls_order_asc is None:

Callers 15

write_queryMethod · 0.95
_write_queryMethod · 0.95
_write_with_clauseMethod · 0.95
_write_select_clauseMethod · 0.95
_write_select_itemMethod · 0.95
_write_struct_columnMethod · 0.95
_write_columnMethod · 0.95
_write_from_clauseMethod · 0.95
_write_inline_viewMethod · 0.95
_write_join_clauseMethod · 0.95

Calls 3

_to_py_nameMethod · 0.95
write_queryMethod · 0.95
typeEnum · 0.50

Tested by

no test coverage detected