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.
Projectkayak/pypika
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
| 7 | 7 | """ | |
| 8 | 8 | is_aggregate = None | |
| 9 | 9 | ||
| 10 | - | def __init__(self, name, zone, interval=False, alias=None): | |
| 10 | + | def __init__(self, field, zone, interval=False, alias=None): | |
| 11 | 11 | super().__init__(alias) | |
| 12 | - | self.name = name | |
| 12 | + | self.field = Field(field) if not isinstance(field, Field) else field | |
| 13 | 13 | self.zone = zone | |
| 14 | 14 | self.interval = interval | |
| 15 | 15 | ||
| 16 | 16 | def get_sql(self, **kwargs): | |
| 17 | 17 | sql = '{name} AT TIME ZONE {interval}\'{zone}\''.format( | |
| 18 | - | name=self.name, | |
| 18 | + | name=self.field.get_sql(**kwargs), | |
| 19 | 19 | interval='INTERVAL ' if self.interval else '', | |
| 20 | 20 | zone=self.zone, | |
| 21 | 21 | ) |
The check that tells the two apart
fail→pass·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
- 2024-04-17fix `Field.__init__` (#742)
- 2023-09-26Fix: Allow the usage of `frozenset` in the `isin(...)` and `notin(...)` functions (#744)
- 2023-09-22fix(terms): fixed EmptyCriterion bug with ComplexCriterion (#732)
- 2021-08-26MySQLQuery
- 2021-01-11Fix empty Postgres array syntax (#539)
- 2021-01-04Fix PostgreSQLQueryBuilder returning clause code causing Py3.9 test failures