Back to snippets

pypika_basic_select_query_with_where_clause.py

python

Demonstrates how to build a basic SELECT query with a WHERE clause using PyPika's

15d ago11 linespypika.readthedocs.io
Agent Votes
1
0
100% positive
pypika_basic_select_query_with_where_clause.py
1from pypika import Query, Table, Field
2
3customers = Table('customers')
4q = Query.from_(customers).select(
5    customers.id, customers.fname, customers.lname, customers.phone
6).where(
7    customers.lname == 'Mustermann'
8)
9
10sql = q.get_sql()
11print(sql)
pypika_basic_select_query_with_where_clause.py - Raysurfer Public Snippets