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

Function generate_inline_sql

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

Source from the content-addressed store, hash-verified

19
20
21def generate_inline_sql(model: Reference, source_col: List[Column], ref_col: List[Column]) -> str:
22 result = comment_to_sql(model.comment) if model.comment else ''
23 result += (
24 f'{{c}}FOREIGN KEY ({col_names(source_col)}) ' # type: ignore
25 f'REFERENCES {get_full_name_for_sql(ref_col[0].table)} ({col_names(ref_col)})' # type: ignore
26 )
27 if model.on_update:
28 result += f' ON UPDATE {model.on_update.upper()}'
29 if model.on_delete:
30 result += f' ON DELETE {model.on_delete.upper()}'
31 return result
32
33
34def generate_not_inline_sql(model: Reference, source_col: List['Column'], ref_col: List['Column']):

Callers 2

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