Not sure why: OperationalError: near "AS": syntax error
It would be really helpful if you could paste the Python code that generated the `File` query.
 The problem appears to be in how you are sorting your files. Maybe try modifying it to be:

``` python
files = File.select().where(File.parent == '/').order_by(File.folder.desc(), File.filename)
```
 Yes, this was the line that created the files

```
    files = File.filter(parent=session['folder']).order_by((File,'folder','DESC'),(File,'filename'))
```
 yep, I replace mine with yours and it works. Thanks for your help.
 No problem! I think you were using the old pre-1.0 syntax. You might check http://peewee.readthedocs.org/en/2.0.2/peewee/upgrading.html#upgrading if you run into similar issues.
 but then, real quick, how would I change

```
foo = File.filter(filename__icontains=someSubstring).order_by(File.folder.desc(), File.filename)
```

I keep getting a **AttributeError: type object 'File' has no attribute 'icontains'**
as you might guess it's a search term.
 ``` python
foo = File.select().where(
    File.filename.contains(someSubstring)).order_by(File.folder.desc(), File.filename)
```

This is all documented: http://docs.peewee-orm.com/en/latest/peewee/querying.html#query-operators
 yep, that's handy. Thanks again.

So I am getting a syntax error deep inside of peewee. 
I'm trying to get the "encrypted-flask-aws" app, pretty much unmodified,
when I try to do a GET on the root of the app,
I get:

```
...venv/lib/python2.7/site-packages/peewee.py", line 2855, in execute_sql
    cursor.execute(sql, params or ())
OperationalError: near "AS": syntax error
```

Just before this error, it run this... 

```
    return render_template('index.html', files=files, breads=breads, path=path)
```

and just before that when I "print files", I have

```
<class '__main__.File'> SELECT "t1"."id", "t1"."filename", "t1"."created_date", "t1"."encrypted", "t1"."folder", "t1"."parent" FROM "file" AS t1 WHERE ("t1"."parent" = ?) ORDER BY ("file" AS t1, ?, ?), ("file" AS t1, ?) [u'/', 'folder', 'DESC', 'filename']
```

And that SQL is being generated for me by Peewee, as it tries to query my sqlite.

any ideas??
