Issue: Maximum recursion depth exceeded
Author: stanep
State: closed
Created: 2015-10-02 16:09:56

Hi, how are you?
I have installed peewee 2.6.4 and have simple sqlite db with one User record.
when I try to run query as this

User.get(User.id == 1) 

I am getting maximum recursion depth error

User.select().where(User.id == 1) # works fine


I don't seem to be able to replicate this:

``` python
In [1]: from peewee import *

In [2]: db = SqliteDatabase(':memory:')

In [3]: class User(Model):
   ...:     username = CharField()
   ...:     class Meta:
   ...:         database = db
   ...:         

In [4]: User.create_table()

In [5]: User.create(username='charlie')
Out[5]: <__main__.User at 0xb52263b0>

In [6]: User.get(User.id == 1)
Out[6]: <__main__.User at 0xb5226610>

In [7]: User.get(User.id == 12)
---------------------------------------------------------------------------
UserDoesNotExist                          Traceback (most recent call last)
<ipython-input-7-862c3fc1e569> in <module>()
----> 1 User.get(User.id == 12)

/home/charles/code/peewee/peewee.py in get(cls, *query, **kwargs)
   4295         if kwargs:
   4296             sq = sq.filter(**kwargs)
-> 4297         return sq.get()
   4298 
   4299     @classmethod

/home/charles/code/peewee/peewee.py in get(self)
   2794             raise self.model_class.DoesNotExist(
   2795                 'Instance matching query does not exist:\nSQL: %s\nPARAMS: %s'
-> 2796                 % self.sql())
   2797 
   2798     def first(self):

UserDoesNotExist: Instance matching query does not exist:
SQL: SELECT "t1"."id", "t1"."username" FROM "user" AS t1 WHERE ("t1"."id" = ?)
PARAMS: [12]

In [9]: import peewee

In [10]: peewee.__version__
Out[10]: '2.6.4'
```


I will check again , I am using proxy class from playhouse though
On Oct 2, 2015 12:16, "Charles Leifer" notifications@github.com wrote:

> I don't seem to be able to replicate this:
> 
> In [1]: from peewee import *
> 
> In [2]: db = SqliteDatabase(':memory:')
> 
> In [3]: class User(Model):
>    ...:     username = CharField()
>    ...:     class Meta:
>    ...:         database = db
>    ...:
> 
> In [4]: User.create_table()
> 
> In [5]: User.create(username='charlie')
> Out[5]: <**main**.User at 0xb52263b0>
> 
> In [6]: User.get(User.id == 1)
> Out[6]: <**main**.User at 0xb5226610>
> 
> In [7]: User.get(User.id == 12)---------------------------------------------------------------------------
> UserDoesNotExist                          Traceback (most recent call last)<ipython-input-7-862c3fc1e569> in <module>()----> 1 User.get(User.id == 12)
> /home/charles/code/peewee/peewee.py in get(cls, _query, *_kwargs)
>    4295         if kwargs:
>    4296             sq = sq.filter(**kwargs)-> 4297         return sq.get()
>    4298
>    4299     @classmethod
> /home/charles/code/peewee/peewee.py in get(self)
>    2794             raise self.model_class.DoesNotExist(
>    2795                 'Instance matching query does not exist:\nSQL: %s\nPARAMS: %s'-> 2796                 % self.sql())
>    2797
>    2798     def first(self):
> 
> UserDoesNotExist: Instance matching query does not exist:
> SQL: SELECT "t1"."id", "t1"."username" FROM "user" AS t1 WHERE ("t1"."id" = ?)
> PARAMS: [12]
> 
> In [9]: import peewee
> 
> In [10]: peewee.**version**
> Out[10]: '2.6.4'
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/coleifer/peewee/issues/726#issuecomment-145074759.


Hi, sorry I found the problem I had override get method on my User model
class, sorry

On Fri, Oct 2, 2015 at 12:27 PM, Stanko Petrovic stanep@gmail.com wrote:

> I will check again , I am using proxy class from playhouse though
> On Oct 2, 2015 12:16, "Charles Leifer" notifications@github.com wrote:
> 
> > I don't seem to be able to replicate this:
> > 
> > In [1]: from peewee import *
> > 
> > In [2]: db = SqliteDatabase(':memory:')
> > 
> > In [3]: class User(Model):
> >    ...:     username = CharField()
> >    ...:     class Meta:
> >    ...:         database = db
> >    ...:
> > 
> > In [4]: User.create_table()
> > 
> > In [5]: User.create(username='charlie')
> > Out[5]: <**main**.User at 0xb52263b0>
> > 
> > In [6]: User.get(User.id == 1)
> > Out[6]: <**main**.User at 0xb5226610>
> > 
> > In [7]: User.get(User.id == 12)---------------------------------------------------------------------------
> > UserDoesNotExist                          Traceback (most recent call last)<ipython-input-7-862c3fc1e569> in <module>()----> 1 User.get(User.id == 12)
> > /home/charles/code/peewee/peewee.py in get(cls, _query, *_kwargs)
> >    4295         if kwargs:
> >    4296             sq = sq.filter(**kwargs)-> 4297         return sq.get()
> >    4298
> >    4299     @classmethod
> > /home/charles/code/peewee/peewee.py in get(self)
> >    2794             raise self.model_class.DoesNotExist(
> >    2795                 'Instance matching query does not exist:\nSQL: %s\nPARAMS: %s'-> 2796                 % self.sql())
> >    2797
> >    2798     def first(self):
> > 
> > UserDoesNotExist: Instance matching query does not exist:
> > SQL: SELECT "t1"."id", "t1"."username" FROM "user" AS t1 WHERE ("t1"."id" = ?)
> > PARAMS: [12]
> > 
> > In [9]: import peewee
> > 
> > In [10]: peewee.**version**
> > Out[10]: '2.6.4'
> > 
> > —
> > Reply to this email directly or view it on GitHub
> > https://github.com/coleifer/peewee/issues/726#issuecomment-145074759.