MCPcopy Create free account
hub / github.com/Vanderhoof/PyDBML / render_note

Function render_note

pydbml/renderer/sql/default/note.py:29–43  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

27
28@DefaultSQLRenderer.renderer_for(Note)
29def 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 ''

Callers 5

test_onelineMethod · 0.90
test_multilineMethod · 0.90
test_index_noteMethod · 0.90

Calls 2

generate_comment_onFunction · 0.85
prepare_text_for_sqlFunction · 0.85

Tested by 5

test_onelineMethod · 0.72
test_multilineMethod · 0.72
test_index_noteMethod · 0.72