Check if all attributes, required for rendering SQL are set in the instance. If some attribute is missing, raise AttributeMissingError
(self)
| 12 | dont_compare_fields: Tuple[str, ...] = () |
| 13 | |
| 14 | def check_attributes_for_sql(self): |
| 15 | ''' |
| 16 | Check if all attributes, required for rendering SQL are set in the |
| 17 | instance. If some attribute is missing, raise AttributeMissingError |
| 18 | ''' |
| 19 | for attr in self.required_attributes: |
| 20 | if getattr(self, attr) is None: |
| 21 | raise AttributeMissingError( |
| 22 | f'Cannot render SQL. Missing required attribute "{attr}".' |
| 23 | ) |
| 24 | @property |
| 25 | def sql(self) -> str: |
| 26 | if hasattr(self, 'database') and self.database is not None: |