Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- json.dumps(
- {
- "tables": {
- f'"{model.schema}"."{model.table}"': {
- "columns": model.columns,
- "relations": {
- "explicit": [
- {
- "source": str(rel.source),
- "destination": str(rel.destination),
- }
- for rel in (
- model.explicit_relations
- if args.output_direction == "foreign-to-primary"
- else [
- rel
- for related_model in schema.tables
- for rel in related_model.explicit_relations
- if rel.destination == model
- ]
- )
- ],
- "implicit": [
- {
- "source": str(rel.source),
- "destination": str(rel.destination),
- }
- for rel in (
- model.implicit_relations
- if args.output_direction == "foreign-to-primary"
- else [
- rel
- for related_model in schema.tables
- for rel in related_model.implicit_relations
- if rel.destination == model
- ]
- )
- ],
- },
- }
- for model in schema.tables
- }
- }
- )
Advertisement
Add Comment
Please, Sign In to add comment