For Tables and Columns Note is converted into COMMENT ON clause. All other entities don't have notes generated in their SQL code, but as a fallback their notes are rendered as SQL comments when sql property is called directly.
(model: Note)
| 27 | |
| 28 | @DefaultSQLRenderer.renderer_for(Note) |
| 29 | def render_note(model: Note) -> str: |
| 30 | """ |
| 31 | For Tables and Columns Note is converted into COMMENT ON clause. All other entities don't |
| 32 | have notes generated in their SQL code, but as a fallback their notes are rendered as SQL |
| 33 | comments when sql property is called directly. |
| 34 | """ |
| 35 | |
| 36 | if model.text: |
| 37 | if isinstance(model.parent, (Table, Column)): |
| 38 | return generate_comment_on(model, model.parent.__class__.__name__, model.parent.name) |
| 39 | else: |
| 40 | text = prepare_text_for_sql(model) |
| 41 | return '\n'.join(f'-- {line}' for line in text.split('\n')) |
| 42 | else: |
| 43 | return '' |