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

Examples from documentation not working (and some missing ones) #69

Closed
michalskop opened this issue Sep 6, 2015 · 2 comments
Closed

Comments

@michalskop
Copy link

I have tried the sqla_example.py from the /examples, but could not replicate some of the examples from the documentation (and similar):

Works:

http://127.0.0.1:5000/people/1
http://127.0.0.1:5000/people?where={"id":"1"}

both return 1 record

http://localhost:5000/people?where={"firstname":"like(\"john\")"}

returns 4 records

http://127.0.0.1:5000/people?where={"lastname":"like(\"oba%\")"}

returns 1 record

Does not work:

http://127.0.0.1:5000/people?where={"lastname":"like(\"%bama\")"}

returns 0 records

http://127.0.0.1:5000/people?where={"firstname":"similar to(\"%ohn\"|\"%acob\")"}

returns 0 records

http://127.0.0.1:5000/people?where={"firstname":"similar to(\"(\'%ohn\'|\'%acob\'\"))"}

returns code 500 and error message simplejson.scanner.JSONDecodeError: Invalid \X escape sequence '': line 1 column 29 (char 28) // Werkzeug Debugger

http://127.0.0.1:5000/people?where={"firstname":"in(\"(\'John\',\'Fred\'\"))"}

returns code 500 and error message simplejson.scanner.JSONDecodeError: Invalid \X escape sequence '': line 1 column 29 (char 28) // Werkzeug Debugger

http://127.0.0.1:5000/people?sort=[("lastname", -1, "nullslast")]

returns code 500 and error message _sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near "NULLS": syntax error [SQL: 'SELECT count(*) AS count_1 \nFROM (SELECT people.firstname || ? || people.lastname AS anon_2, people._created AS people__created, people._updated AS people__updated, people.etag AS people__etag, people.id AS people_id, people.firstname AS people_firstname, people.lastname AS people_lastname \nFROM people ORDER BY people.lastname DESC NULLS LAST) AS anon_1'] [parameters: (' ',)] // Werkzeug Debugger

Missing examples
It would be great to add examples:

  • how to use basic operators as AND and OR(e.g., WHERE lastname='Obama' OR firstname='John')
  • basic python requests example
    as this does not work, returns code 500:
import requests
p = {
    "where": {
        "id": "1"
    }
}
url = "http://127.0.0.1:5000/people"
r = requests.get(url, params = p)
@amleczko
Copy link
Member

Can you make a PR with those fixes? It would help a lot!

@michalskop
Copy link
Author

Unfortunately, I cannot make a pull request. I actually do not know how to make the Does not work stuff to get working, nor the Missing examples (even after several hours of playing with it).

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

No branches or pull requests

2 participants