Skip to content

Automatically generate schema #2

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:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions