kayak / pypika

PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.
http://pypika.readthedocs.io/en/latest/
Apache License 2.0
2.44k stars 293 forks source link

Space in field names, SQL Server #638

Open victorpbr opened 2 years ago

victorpbr commented 2 years ago

Hi,

In my SQL Server, I have some fields that have spaces in their names such as "Document Type", having issues in building a query to filter using this fields.

q = MSSQLQuery.from_(query_table).select(
    queryColsadj).where(query_table.Document Type != "Order")

How do I reference the field name in the query if it has spaces?

twheys commented 2 years ago

Hi @victorpbr query_table['Document Type'] should work as well