Skip to content

mssql dialect omits limit/offset wrapping on second compile; alters the statement #2545

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot
Collaborator

Migrated issue, originally created by Anonymous

In MSSQL When doing a query such as:

            qry = select([nemsis_model.Nemsis.table](nemsis_model.Nemsis.table), order_by=[nemsis_model.Nemsis.patient_care_report_number](nemsis_model.Nemsis.ems_agency_number,),limit = limit,offset=offset)

Evaluating the query twice causes it to drop the limit and offset on the second evaluation

An easy way to show what I suspect is happening is if I log the qry twice:

        log.info(qry)
        log.info(qry)

The second case will not display the constraints on record_number.

This took a while to track down as I was trying to do a select and not getting why the results of my select differed from the logging I did right before it.

Activity

sqlalchemy-bot

sqlalchemy-bot commented on Aug 12, 2012

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

fortunately a test case could be devised here easily:

from sqlalchemy import *

m = MetaData()
t = Table('t', m, Column('x', ))

s = select([t](t)).order_by(t.c.x).limit(5).offset(2)

from sqlalchemy.dialects import mssql

print s.compile(dialect=mssql.dialect())
print s.compile(dialect=mssql.dialect())
sqlalchemy-bot

sqlalchemy-bot commented on Aug 12, 2012

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • removed labels: high priority
  • added labels: blocker
  • set milestone to "0.7.9"
  • changed title from "Bug in mssql evaluating a query" to "mssql dialect omits limit/offset wrapping on secon"
sqlalchemy-bot

sqlalchemy-bot commented on Aug 12, 2012

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

8340361
2e75064

sqlalchemy-bot

sqlalchemy-bot commented on Aug 12, 2012

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
added
SQL ServerMicrosoft SQL Server, e.g. mssql
bugSomething isn't working
blockerissue that must be resolved asap as it is preventing things from working
on Nov 27, 2018
added this to the 0.7.9 milestone on Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SQL ServerMicrosoft SQL Server, e.g. mssqlblockerissue that must be resolved asap as it is preventing things from workingbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sqlalchemy-bot

        Issue actions

          mssql dialect omits limit/offset wrapping on second compile; alters the statement · Issue #2545 · sqlalchemy/sqlalchemy