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

For Postgres: 'QueryBuilder' object has no attribute 'where_between' #447

Closed
egwald opened this issue Apr 18, 2021 · 6 comments · Fixed by #449
Closed

For Postgres: 'QueryBuilder' object has no attribute 'where_between' #447

egwald opened this issue Apr 18, 2021 · 6 comments · Fixed by #449
Labels
bug An existing feature is not working as intended

Comments

@egwald
Copy link

egwald commented Apr 18, 2021

For Postgres: 'QueryBuilder' object has no attribute 'where_between':

` def get_pg_data_date(self, tabelle, startDate, endDate):

    builder = QueryBuilder().table(tabelle)
    results = builder.table(tabelle).where_between('timestamp', startDate, endDate).get()
    return results

`

@egwald egwald added the bug An existing feature is not working as intended label Apr 18, 2021
@circulon
Copy link
Contributor

A similar issue is discussed (and solved) here #407

@Marlysson
Copy link
Contributor

This PR #50
And the issue #49

Talk about it too.

@josephmancuso
Copy link
Member

The solution here could be to just alias the between method with a new where_between method

@Marlysson
Copy link
Contributor

Marlysson commented Apr 22, 2021

@josephmancuso The feature of between/not between is working in tests ( testing against generated sql is fine ) but when calling by QueryBuilder or Model it fails.

I suspect that q_mark() method isn't marking sql to fill with bindings. I'm seeing this, but is odd..

In QueryBuilder when in .get() method is changed to the following snippet works:

def get(self, selects=[]):
        """Runs the select query built from the query builder.

        Returns:
            self
        """
        self.select(*selects)
        -> bindings = self._bindings # Preserving the bindings ( because to_qmark() reset it )
        result = self.new_connection().query(self.to_qmark(), bindings)

        return self.prepare_result(result, collection=True)

Just in couterpart a bunch of tests failing haha

@josephmancuso
Copy link
Member

I don't understand? There should be no where_between method. The correct method is called between.

builder.between()

@Marlysson
Copy link
Contributor

You're right. The builder.between() in tests are working because it are tested against in sql grammar, but then it is ran using some database it fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants