SQL Generator#
- class besser.generators.sql.sql_generator.SQLGenerator(model: DomainModel, output_dir: str = None, sql_dialect: str = 'sqlite')[source]#
Bases:
GeneratorInterface
SQLGenerator is a class that implements the GeneratorInterface and produces the code or set of SQL statements used to define and modify the structure of the tables in a database.
- Parameters:
model (DomainModel) – An instance of the DomainModel class representing the B-UML model.
output_dir (str, optional) – The output directory where the generated code will be saved. Defaults to None.
sql_dialect (str, optional) – The SQL dialect. Values allowed: “sqlite”, “postgresql”, “mysql”,
"mssql" –
"sqlite". (or "mariadb". Defaults to) –
- _abc_impl = <_abc._abc_data object>#
- generate()[source]#
Generates SQL code based on the provided B-UML model and saves it to the specified output directory. If the output directory was not specified, the code generated will be stored in the <current directory>/output folder.
- Returns:
None, but store the generated code as a file named tables.sql.