Giter Site home page Giter Site logo

Can we get another release about django-cte HOT 5 CLOSED

dimagi avatar dimagi commented on July 22, 2024
Can we get another release

from django-cte.

Comments (5)

millerdev avatar millerdev commented on July 22, 2024

@warmwaffles thanks for checking, I also would love to get a new release out the door. Have you had a chance to review the discussion at #17 (comment)? That outlines some reasons for why I'm holding off on a release at this time. TLDR I'm concerned that the changes in #18 are too fragile to force on everyone without warning.

I would consider a beta release if it can be done in a way that will only affect people who opt-in to using it (i.e., not be automatically installed by pip install --upgrade django-cte). I'll have to research if that's possible.

As a temporary workaround you can install a specific commit like so:

pip install "git+git://github.com/dimagi/django-cte@ab0cf7e6a0be7a41c6b646377a2e70b1e896c4c1#egg=django-cte"

from django-cte.

warmwaffles avatar warmwaffles commented on July 22, 2024

@millerdev I'll pull that into my project and see if this helps me. Will report back on Monday mid day.

from django-cte.

warmwaffles avatar warmwaffles commented on July 22, 2024

I've had to table the upgrade to 3.0 because there are other issues outstanding with other libraries. I'll revisit this once I get those other issues resolved.

from django-cte.

warmwaffles avatar warmwaffles commented on July 22, 2024

@millerdev so I had to clone this project into my main project and found that QJoin has issues when trying to join on a non FK field. In my case, I was joining on a text field and was encountering errors.

Here's my "solution", it's not pretty, I don't know why it works, but it does.

class CTEQuery(Query):
    # ...

    def set_group_by(self, allow_aliases=True):
        """
        Expand the GROUP BY clause required by the query.
        This will usually be the set of all non-aggregate fields in the
        return data. If the database backend supports grouping by the
        primary key, and the query would be equivalent, the optimization
        will be made automatically.
        """
        # Column names from JOINs to check collisions with aliases.
        if allow_aliases:
            column_names = set()
            seen_models = set()
            for join in list(self.alias_map.values())[1:]:  # Skip base table.
                model = join.join_field.related_model
                # ---------------------------------------------------
                # This is shimmed in from the original implementation
                # ---------------------------------------------------
                if not model:
                    continue

                if model not in seen_models:
                    column_names.update(
                        {field.column for field in model._meta.local_concrete_fields}
                    )
                    seen_models.add(model)

        group_by = list(self.select)
        if self.annotation_select:
            for alias, annotation in self.annotation_select.items():
                signature = inspect.signature(annotation.get_group_by_cols)
                if "alias" not in signature.parameters:
                    annotation_class = annotation.__class__
                    msg = (
                        "`alias=None` must be added to the signature of "
                        "%s.%s.get_group_by_cols()."
                    ) % (annotation_class.__module__, annotation_class.__qualname__)
                    warnings.warn(msg, category=RemovedInDjango40Warning)
                    group_by_cols = annotation.get_group_by_cols()
                else:
                    if not allow_aliases or alias in column_names:
                        alias = None
                    group_by_cols = annotation.get_group_by_cols(alias=alias)
                group_by.extend(group_by_cols)
        self.group_by = tuple(group_by)

from django-cte.

millerdev avatar millerdev commented on July 22, 2024

django-cte v1.2.0 released! 🎉

from django-cte.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.