One function

AtTimezone in kayak/pypika

The author described this change as Fix AtTimezone to call field get sql. It counts as a record because the check below fails on the code as it stood at 374ed1a51 and passes on 9745e44f1, with nothing else changed between the two runs.

Fix saved2020-06-29
Sharing licenceApache-2.0 · LICENSE.txt
Change size+3 3

What the code was meant to do, written into the code itself as a docstring

Generates AT TIME ZONE SQL. Examples: AT TIME ZONE 'US/Eastern' AT TIME ZONE INTERVAL '-06:00'

The change

77 """
88 is_aggregate = None
99
10- def __init__(self, name, zone, interval=False, alias=None):
10+ def __init__(self, field, zone, interval=False, alias=None):
1111 super().__init__(alias)
12- self.name = name
12+ self.field = Field(field) if not isinstance(field, Field) else field
1313 self.zone = zone
1414 self.interval = interval
1515
1616 def get_sql(self, **kwargs):
1717 sql = '{name} AT TIME ZONE {interval}\'{zone}\''.format(
18- name=self.name,
18+ name=self.field.get_sql(**kwargs),
1919 interval='INTERVAL ' if self.interval else '',
2020 zone=self.zone,
2121 )

The check that tells the two apart

failpass·pypika/tests/test_terms.py::AtTimezoneTests::test_passes_kwargs_to_field_get_sql

Check file pypika/tests/test_terms.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it374ed1a51372eaf05b5b16122e3ab92014047c47
Broken version dated2020-06-29
Modulepypika.terms
Units changedAtTimezone
Fingerprint1ae5ba982b50b250
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in kayak/pypika