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

Allow the primary key to not be named "id" #20

Closed
Naddiseo opened this issue Jul 30, 2014 · 2 comments
Closed

Allow the primary key to not be named "id" #20

Naddiseo opened this issue Jul 30, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@Naddiseo
Copy link

Currently, the code makes the assumption that there is a field called "id". I have a model that looks a little like:

class MyModel(Model):
    pk = Column('id', Integer, primary_key = True)
    ...

Reason being that I don't like to override python built-ins.

@uralbash uralbash added this to the mptt v0.0.6 milestone Jul 30, 2014
@uralbash uralbash self-assigned this Jul 30, 2014
@uralbash uralbash added the bug label Jul 30, 2014
@uralbash
Copy link
Owner

I want to add a new parameter 'sqlalchemy_mptt_pk_name' in sqlalchemy_mptt v0.0.6
I think this will solve your problem. For example:

class MPTTPages(BasePages, Base):
    __tablename__ = "mptt_pages"
    pk = Column('id', Integer, primary_key=True)
    sqlalchemy_mptt_pk_name = 'pk'

'id' will default

@uralbash
Copy link
Owner

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

No branches or pull requests

2 participants