MCPcopy Index your code
hub / github.com/Vanderhoof/PyDBML / generate_not_inline_sql

Function generate_not_inline_sql

pydbml/renderer/sql/default/reference.py:34–45  ·  view source on GitHub ↗
(model: Reference, source_col: List['Column'], ref_col: List['Column'])

Source from the content-addressed store, hash-verified

32
33
34def generate_not_inline_sql(model: Reference, source_col: List['Column'], ref_col: List['Column']):
35 result = comment_to_sql(model.comment) if model.comment else ''
36 result += (
37 f'ALTER TABLE {get_full_name_for_sql(source_col[0].table)}' # type: ignore
38 f' ADD {{c}}FOREIGN KEY ({col_names(source_col)})'
39 f' REFERENCES {get_full_name_for_sql(ref_col[0].table)} ({col_names(ref_col)})' # type: ignore
40 )
41 if model.on_update:
42 result += f' ON UPDATE {model.on_update.upper()}'
43 if model.on_delete:
44 result += f' ON DELETE {model.on_delete.upper()}'
45 return result + ';'
46
47
48def generate_many_to_many_sql(model: Reference) -> str:

Callers 3

test_simpleMethod · 0.90

Calls 3

comment_to_sqlFunction · 0.90
get_full_name_for_sqlFunction · 0.90
col_namesFunction · 0.85

Tested by 2

test_simpleMethod · 0.72