Skip to content

Extend support for conditionals #42

@svengiegerich

Description

@svengiegerich

For my project, I'm currently trying to use pytsql for use cases beyond replacing DB or table names. In particular, I want to make use of conditionals.
However, I run into some issues there:

  • Executing certain functions within conditionals throws me (an) unexpected error(s)
    • E.g., if you want to parameterize whether a certain table or a view is created. For views, I use the following approach:
IF 1 = 1
BEGIN
     SET NONEXEC ON
END
GO
CREATE VIEW v AS ...
SET NONEXEC OFF

... however, pytsql indirectly throws me an unexpected error via sqlalchemy:
sqlalchemy.exec.ResourceClosedError: This result object does not return rows. It has been closed automatically. (If it's helpful I can also post the full error, but that requires some anonymization first)

  • Declaring variables within the conditional seems current not possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions