MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / CreateTable

Class CreateTable

misc/python/materialize/zippy/table_actions.py:59–89  ·  view source on GitHub ↗

Creates a table on the Mz instance. 50% of the tables have a default index.

Source from the content-addressed store, hash-verified

57
58
59class CreateTable(Action):
60 """Creates a table on the Mz instance. 50% of the tables have a default index."""
61
62 @classmethod
63 def requires(cls) -> set[type[Capability]]:
64 return {BalancerdIsRunning, MzIsRunning}
65
66 def __init__(self, table: TableExists, capabilities: Capabilities) -> None:
67 assert (
68 table is not None
69 ), "CreateTable Action can not be referenced directly, it is produced by CreateTableParameterized factory"
70 self.table = table
71 super().__init__(capabilities)
72
73 def run(self, c: Composition, state: State) -> None:
74 index = (
75 f"> CREATE DEFAULT INDEX ON {self.table.name}"
76 if self.table.has_index
77 else ""
78 )
79 c.testdrive(
80 dedent(f"""
81 > CREATE TABLE {self.table.name} (f1 INTEGER);
82 {index}
83 > INSERT INTO {self.table.name} VALUES ({self.table.watermarks.max});
84 """),
85 mz_service=state.mz_service,
86 )
87
88 def provides(self) -> list[Capability]:
89 return [self.table]
90
91
92class ValidateTable(Action):

Callers 13

newMethod · 0.70
plan_create_tableFunction · 0.50
parse_create_tableMethod · 0.50
parse_main_statementFunction · 0.50
into_parser_statementMethod · 0.50
validate_single_variantFunction · 0.50
parse_stmtFunction · 0.50
normalize_name_withMethod · 0.50
make_typed_objectFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected