-
Notifications
You must be signed in to change notification settings - Fork 301
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
[1.0.01b] primary_key argument in create_api_blueprint() #540
Comments
id
attribute
In the following code, it is also assumed that |
As for the As for the BigInteger issue, can you please open a new issue for it? Thank you. |
Hi Any update on the issue requiring an id, even if a primary key column is present? |
I have not had a chance to create a testcase, but if I modify an example in the doc to reproduce: class Person(Base):
person_id = Column(Integer, primary_key=True) # person_id instead of id
blueprint = manager.create_api_blueprint('person', Person, methods=methods) And then, if there is a GET request, the error should be thrown. |
I have got myself running with the following patch. I haven't tested any further than it seems to work for me. https://github.com/tanj/flask-restless/commit/a0880befbbacf49efc59cd7ecea02e6a944c2f75 |
After doing a pip install git+https checkout of the code, I was able to at least boot my flask server with lines 598-600 commented out. |
@yhosun Thanks for providing a test, I'll use that example as the basis for a unit test. @tanj Thanks for the suggested patch, I'll use that as the basis for a more complete solution. @smitty1eGH The top answer is mine from when I was trying to figure out how to find primary keys programmatically :) This should be fixable by using the |
Fixed by pull request #581. Thanks for your help! |
In 1.0.01b, even if
primary_key
argument is provided,create_api_blueprint()
throws:I think this validation also needs to consider the value of
primary_key
:https://github.com/jfinkels/flask-restless/blob/master/flask_restless/manager.py#L597-L599
I also have a question:
http://flask-restless.readthedocs.io/en/1.0.0b1/basicusage.html?highlight=sqlalchemy.Integer
Do you also support a primary key column of sqlalchemy.BigInteger? In 0.17.0, I did not notice any issue with it.
The text was updated successfully, but these errors were encountered: