Skip to content

Automatically generate schema #2

@fernandojunior

Description

@fernandojunior

Find a way to automatically generate schema for Models

schema = '''
        drop table if exists post;

        create table model_name (
            id integer primary key autoincrement,
            ...
        );
        '''

A model must be something like this:

    class A(Model):
        a = int  # OK
        b = bool  # TODO
        c = float  # OK
        d = str  # OK
        e = chr  # TODO 'CHARACTER(1)'
        f = datetime  # TODO 'DATETIME' convert to timestamp
        b = {'unique':true, 'type': str}
        # ...
        def __init__(self):
            pass

    class B(Model):
        one = A
        def __init__(self):
            pass

    class C(Model):
        many = [B]
        def __init__(self):
            pass

References:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions