Closed FChikh closed 10 months ago
The indentation of the jinja commands doesn't seem right (all seem to be on the same position even for instructions within a loop or conditional)
Also, this is not a SQL generator, it is a Postgresql generator.
You could probably refactor the code to have a common part as a SQLGenerator (at least the structure of going through the classes, ends,...) and then a specific part where we use the specific types and syntax of postrgresql
I would suggest avoiding relative imports and using absolute imports. PEP 8 (Style Guide for Python Code) explicitly recommends absolute imports because they are usually more readable and tend to be better behaved.
We have currently the src/ directory, then the following import:
from ...BUML.metamodel.structural.structural import DomainModel
could be replaced by this:
from BUML.metamodel.structural.structural import DomainModel
The indentation of the jinja commands doesn't seem right (all seem to be on the same position even for instructions within a loop or conditional)
The following could be a solution to address indentation in Jinja templates and improve readability
https://ttl255.com/jinja2-tutorial-part-3-whitespace-control/#block-ind
1) Fixed indentation, thank you for resources
2) Added a separate file sql_dialects.sql.j2
, where I put parts of pure SQL code, with the option of choosing a dialect (PostgreSQL and MySQL are available for now, as a demonstration)
BUML -> SQL converter Generates SQL query from Jinja template; available for conversion - Classes, Properties, Associations; coming - Generalizations. I also implemented GeneratorInterface to access the generator.