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

[mssql] Allow SQL queries as layer sources #60728

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

nyalldawson
Copy link
Collaborator

Allows loading SQL Server queries as map layers from the browser, and updating the SQL for existing query layers

Sponsored by City of Canning

Fixes #19301

(temporarily contains various other open PRs with fixes for the mssql provider)

Lightens load when browsing SQL Server connections via browser
Follows the approach used by eg the postgres provider, where a mssql
layer can specify an arbitrary SQL query to use as the layer's
source instead of a table.

This is done by using the URI form:

   table="(SELECT ...)" key='primary_key' srid=4326 type=POINT

The query MUST be wrapped in (), and the primary key and geometry
properties MUST be set in the URI.

Note that SQL Server requirements mandate that EVERY column in the query
must have an explicit name/alias set, or the database queries will
fail.

Sponsored by City of Canning
Allows loading SQL Server queries as map layers from the browser,
and updating the SQL for existing query layers

Sponsored by City of Canning
@nyalldawson nyalldawson added Feature Changelog Items that are queued to appear in the visual changelog - remove after harvesting MS SQL data provider labels Feb 24, 2025
@qgis-bot
Copy link
Collaborator

@nyalldawson

This pull request has been tagged for the changelog.

  • The description will be harvested so please provide a "nearly-ready" text for the final changelog
  • If possible, add a nice illustration of the feature. Only the first one in the description will be harvested (GIF accepted as well)
  • If you can, it's better to give credits to your sponsor, see below for different formats.

You can edit the description.

Format available for credits
  • Funded by NAME
  • Funded by URL
  • Funded by NAME URL
  • Sponsored by NAME
  • Sponsored by URL
  • Sponsored by NAME URL

Thank you!

@github-actions github-actions bot added this to the 3.44.0 milestone Feb 24, 2025
Copy link

github-actions bot commented Feb 24, 2025

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit aae0c08)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit aae0c08)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog Items that are queued to appear in the visual changelog - remove after harvesting Feature MS SQL data provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use SELECT query as data source in MSSQL
2 participants