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

Class CreateFile

misc/python/materialize/mzexplore/common.py:178–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176
177@dataclass(frozen=True)
178class CreateFile:
179 database: str
180 schema: str
181 name: str
182 item_type: ItemType
183
184 def file_name(self) -> str:
185 return f"{self.name}.sql"
186
187 def folder(self) -> Path:
188 return Path(self.item_type.value, self.database, self.schema)
189
190 def path(self) -> Path:
191 return self.folder() / self.file_name()
192
193 def __str__(self) -> str:
194 return str(self.path())
195
196 def skip(self) -> bool:
197 # Skip _progress sources (they don't have a DDL)
198 if self.item_type == ItemType.SOURCE:
199 return self.name.endswith("_progress")
200 # Skip items with database, schema, or item names that contain a `/`
201 # (not a valid UNIX folder character).
202 elif "/" in self.database:
203 warn(f"Skip processing of item with bad database name: `{self.database}`")
204 return True
205 elif "/" in self.schema:
206 warn(f"Skip processing of item with bad schema name: `{self.schema}`")
207 return True
208 elif "/" in self.name:
209 warn(f"Skip processing of item with bad item name: `{self.name}`")
210 return True
211 # All good!
212 else:
213 return False
214
215
216@dataclass(frozen=True)

Callers 2

defsFunction · 0.90
plansFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected