Issue: Avoid quoting of table/column names
Author: ananis25
State: closed
Created: 2019-02-12 07:07:45

I couldn't quite figure how to create table and column names without quote characters. Needed since I haven't created the SQL tables I'm reading from. Is there a way to achieve this without monkey patching?

Suggestion:
A possible way to do this could be to use a modified Database class with quote variable set to a tuple of 2 empty strings. This does fail however since the `quote_char` variable is expected to be the type `str` in the Cython `quote` function at `playhouse/_speedups.pyx`

```
class PostgresModified(peewee.PostgresqlDatabase):
    quote = ('', '')   # tuple of empty strings in place of double quotes which is the peewee default

# an empty string doesn't work since the quote function in Peewee.py uses join method on the string.
```

Using a tuple instead of a string also halves the time it takes for the `quote` function. Given @coleifer has written a Cython method to presumably speed it up, could this be useful - accept `quote` as a 2 character string but store it as a 2-tuple?

Just saw this 5ff2d8a where @coleifer moved from a tuple of characters to strings, so clearly Cython must provide speedup better than 50 p/c. 

Do you think it'd still be useful to allow a tuple for the above use-case?

Internet also helped me with a simple way to get around this, so the cython method isn't used. Please close the issue if it isn't worth the trouble :)
```
import sys
sys.modules['playhouse._speedups'] = None
```

I've gone ahead and removed the speedups extension as it was a holdover from 2.x and is not really necessary anymore. It provides a tiny performance improvement for identifier quoting, but its so minimal that I don't think it justifies the existence of the additional C extension. So: going forward in the next release, the "speedups" module will be gone.

> Needed since I haven't created the SQL tables I'm reading from.

I don't understand what quoting has to do with this?

Please comment as to why quoted identifiers are causing problems with your DB/application. For now I am closing, as the speedups-specific issue is fixed.

Sure. I'm using an existing table in Postgres where the identifiers were not created with quotes.
```
CREATE TABLE tableA (userId int);
```

When using Peewee to construct queries for this table, I created a class with the column identifiers camel-cased (a solution would be to use lower-case names, but the data schema everywhere else uses camelcase). Hence the query comes out to be off.

```
class tableA(Model):
    userId = IntegerField()

print(tableA.select(tableA.userId).sql())
> 'SELECT "t1"."userId" FROM "tablea" AS "t1"'
# this throws since the column "t1.userId" doesn't exist
```

With the `speedups` routine removed, it'd be easy to override quoting by providing `('', '')` as quote characters. Thank you very much for looking!


You can override the table and column names:

```python
class AnyName(Model):
    anything = TextField(column_name="colA")
    class Meta:
        table_name = "tableA"
```

If you read the doc's you would have probably saved us both time.

http://docs.peewee-orm.com/en/latest/peewee/models.html#field-initialization-arguments

http://docs.peewee-orm.com/en/latest/peewee/models.html#model-options-and-table-metadata

Thanks for the reference. I do make use of the table_name parameter It hadn't struck me that using column_name would've solved this. Really appreciate your quick response.

Glad to have been able to help.