Below, I show a simple example. The generated SQL has a difference in the "" around the field, but in the docs it is showed as equivalent.
What is the proper use case for these features ?
from pypika import Table, Query, Field, Parameter
shops = Table("shops")
first_query = Query.from_(shops).select(
Field(shops.id, 'identification')
).where(
shops.id == Parameter("%(shop_id)s")
)
# SELECT ""id"" "identification" FROM "shops" WHERE "id"=%(shop_id)s
second_query = Query.from_(shops).select(
shops.id.as_('identification')
).where(
shops.id == Parameter("%(shop_id)s")
)
# SELECT "id" "identification" FROM "shops" WHERE "id"='%(shop_id)s'
assert first_query == second_query
print(first_query, second_query)