Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp between interaction on Python codegen #3696

Open
otavioabreu27 opened this issue Nov 8, 2024 · 0 comments
Open

Timestamp between interaction on Python codegen #3696

otavioabreu27 opened this issue Nov 8, 2024 · 0 comments
Labels
📚 postgresql bug Something isn't working 💻 linux 🔧 python Pull requests that update Python code

Comments

@otavioabreu27
Copy link

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:

image

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

@otavioabreu27 otavioabreu27 added the bug Something isn't working label Nov 8, 2024
@dosubot dosubot bot added 📚 postgresql 💻 linux 🔧 python Pull requests that update Python code labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 postgresql bug Something isn't working 💻 linux 🔧 python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

1 participant