Whole file

andialbrecht/sqlparse

The author described this change as Fix Function.get_parameters(), add Funtion.get_window(). It counts as a record because the check below fails on the code as it stood at 617b8f6cd and passes on e03b74e60, with nothing else changed between the two runs.

Fix saved2024-04-13
Sharing licenceBSD-3-Clause · LICENSE
Change size+8 1

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

Fix Function.get_parameters(), add Funtion.get_window()

The change

623623
624624 def get_parameters(self):
625625 """Return a list of parameters."""
626- parenthesis = self.tokens[-1]
626+ parenthesis = self.token_next_by(i=Parenthesis)[1]
627627 result = []
628628 for token in parenthesis.tokens:
629629 if isinstance(token, IdentifierList):
632632 t=T.Literal):
633633 result.append(token)
634634 return result
635+
636+ def get_window(self):
637+ """Return the window if it exists."""
638+ over_clause = self.token_next_by(i=Over)
639+ if not over_clause:
640+ return None
641+ return over_clause[1].tokens[-1]
635642
636643
637644 class Begin(TokenList):

The check that tells the two apart

failpass·tests/test_grouping.py::test_grouping_function

Check file tests/test_grouping.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 it617b8f6cd3c55bacf2c80130901508518753f7e1
Broken version dated2024-04-13
Modulesqlparse.sql
Units changedFunction
Fingerprintc9c2bc1b1a19823e
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 andialbrecht/sqlparse