MySQL Queries via Peewee are not bringing back data.

30 views
Skip to first unread message

Space

unread,
Feb 18, 2021, 7:54:52 PM2/18/21
to peewee-orm
I switched from an SQLite database to a MySQL database. I've created and converted an `.sql` file to MySQL and I have confirmed that all of the data has moved on the server. The only problem is that now I am unable to get any results despite the entry existing on the server. I've done this on another project and it worked fine but im not sure what went wrong here. 

My code:
```
databaseData = [database.MRP_Blacklist_Data.DiscUsername, database.MRP_Blacklist_Data.DiscID, database.MRP_Blacklist_Data.Gamertag, database.MRP_Blacklist_Data.BannedFrom, database.MRP_Blacklist_Data.KnownAlts, database.MRP_Blacklist_Data.ReasonforBan, database.MRP_Blacklist_Data.DateofIncident, database.MRP_Blacklist_Data.TypeofBan, database.MRP_Blacklist_Data.DatetheBanEnds, database.MRP_Blacklist_Data.entryid]
ResultsGiven = False

for data in databaseData:
  query = (database.MRP_Blacklist_Data.select().where(data.contains(req)))
  if query.exists():
      for p in query:
        ResultsGiven = True
  if ResultsGiven == False:
      print("No Results")
```


Space

unread,
Feb 18, 2021, 8:00:18 PM2/18/21
to peewee-orm

I've just noticed that Peewee has created new tables with the same name but lowercase.
Is there a way to point it to the original uppercase ones?

Charles Leifer

unread,
Feb 19, 2021, 9:07:38 AM2/19/21
to peewe...@googlegroups.com
Specify the table name explicitly:

class MyModel(Model):
    class Meta:
        table_name = 'MyModel'

--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/peewee-orm/6c850174-dfb1-4dd8-93ff-ed9cd92d3c75n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages