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

Specify the schema to use for a table #102

Open
GohuHQ opened this issue Jun 21, 2019 · 1 comment
Open

Specify the schema to use for a table #102

GohuHQ opened this issue Jun 21, 2019 · 1 comment
Assignees
Labels
Milestone

Comments

@GohuHQ
Copy link
Contributor

@GohuHQ GohuHQ commented Jun 21, 2019

It can be useful in a class model and it's maybe something we want to specify at a name space level depending on the use case..

Here is the solution we used for the moment to target the db schema :

@Declarations.register(Declarations.Core)
class SqlBase:
    __schema__ = None

    @classmethod
    def define_table_kwargs(cls):
        res = super(SqlBase, cls).define_table_kwargs()
        if cls.__schema__ is not None:
            res.update({'schema': cls.__schema__})
        return res


@Declarations.register(Declarations.Model, tablename='Order')
class Order:
  __schema__ = 'MySchema'
@GohuHQ

This comment has been minimized.

Copy link
Contributor Author

@GohuHQ GohuHQ commented Jun 24, 2019

We have also detected that creating new columns in the table is not possible yet.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.