Timestamp between interaction on Python codegen
otavioabreu27 opened this issue · 0 comments
otavioabreu27 commented
Version
1.27.0
What happened?
When making a query that has a 'where timestamp between', for example:
SELECT
COUNT(*)
FROM
searches s
JOIN
rel_searches_availables rsa ON s.s_id = rsa.rsa_search_id
WHERE
s.s_search_date_timestamp BETWEEN $1 AND $2;
The code generated make both parameters have the same name, which is not valid on Python.
def count_availables_time_window(self, *, s_search_date_timestamp: datetime.datetime, s_search_date_timestamp: datetime.datetime) -> Optional[int]:
row = self._conn.execute(sqlalchemy.text(COUNT_AVAILABLES_TIME_WINDOW), {"p1": s_search_date_timestamp, "p2": s_search_date_timestamp}).first()
if row is None:
return None
return row[0]
Thus creating the error bellow:
Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
No response
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Python