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

Class Table

tests/comparison/common.py:498–624  ·  view source on GitHub ↗

Represents a standard database table.

Source from the content-addressed store, hash-verified

496
497
498class Table(TableExpr):
499 '''Represents a standard database table.'''
500
501 def __init__(self, name):
502 self.name = name
503 self._cols = [] # can include CollectionColumns and StructColumns
504 self._unique_cols = []
505 self.alias = None
506 self.is_visible = True # Tables used in SEMI or ANTI JOINs are invisible
507
508 # Only used for data loading. Always stored in upper-case. If set, values will be
509 # something like 'PARQUET' or 'TEXT'. See cli_options.py for a full list of
510 # possible values.
511 self._storage_format = None
512
513 # Only used for data loading. For Impala and Hive, this is the path to the directory
514 # in the storage system, such as an HDFS URL.
515 self.storage_location = None
516
517 # Only used for data loading. Avro tables may require a separate schema definition,
518 # this is the path to the schema file in the storage system, such as an HDFS URL.
519 self.schema_location = None
520
521 @property
522 def identifier(self):
523 return self.alias or self.name
524
525 @property
526 def primary_keys(self):
527 """
528 Return immutable sequence of primary keys.
529 """
530 return tuple(col for col in self._cols if col.is_primary_key)
531
532 @property
533 def primary_key_names(self):
534 """
535 Return immutable sequence for primary key names.
536 """
537 return tuple(col.name for col in self.primary_keys)
538
539 @property
540 def updatable_columns(self):
541 """
542 Return immutable sequence of columns that may be updated (i.e., not primary keys).
543
544 If the table doesn't have primary keys, no columns are updatable.
545 """
546 if self.primary_keys:
547 return tuple(col for col in self._cols if not col.is_primary_key)
548 else:
549 return ()
550
551 @property
552 def updatable_column_names(self):
553 """
554 Return immutable sequence of column names that may be updated
555 """

Callers 11

_create_random_tableMethod · 0.90
describe_tableMethod · 0.90
FakeTableFunction · 0.90
test_table_modelMethod · 0.90
__deepcopy__Method · 0.70
__get_test_tblMethod · 0.50
__deepCopyTableMethod · 0.50

Implementers 1

CalciteTablejava/calcite-planner/src/main/java/org

Calls

no outgoing calls

Tested by 5

test_table_modelMethod · 0.72
__get_test_tblMethod · 0.40
__deepCopyTableMethod · 0.40