SQLAlchemy Generator#

class besser.generators.sql_alchemy.sql_alchemy_generator.SQLAlchemyGenerator(model: DomainModel, output_dir: str = None)[source]#

Bases: GeneratorInterface

SQLAlchemyGenerator is a class that implements the GeneratorInterface and is responsible for generating SQLAlchemy code based on B-UML models.

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.

TYPES = {'bool': 'Boolean', 'date': 'Date', 'datetime': 'DateTime', 'float': 'Float', 'int': 'Integer', 'str': 'String(100)', 'time': 'Time'}#
_abc_impl = <_abc._abc_data object>#
generate()[source]#

Generates SQLAlchemy 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 sql_alchemy.py