Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically generate schema #2

Open
fernandojunior opened this issue Mar 26, 2016 · 0 comments
Open

Automatically generate schema #2

fernandojunior opened this issue Mar 26, 2016 · 0 comments

Comments

@fernandojunior
Copy link
Owner

fernandojunior commented Mar 26, 2016

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:

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

No branches or pull requests

1 participant