Skip to content

Conversation

@azahnen
Copy link
Collaborator

@azahnen azahnen commented Sep 5, 2024

Adds support for custom SQL expressions and other join types than INNER.

Examples

areaValue:
  sourcePath: "[EXPRESSION]{sql=$T$.afl+55.5}"
  type: FLOAT
geometrie:
   sourcePath: "[sch=schl]katasterbezirk{joinType=LEFT}/geometrie"

Todo

  • issue
  • docs
  • disable queryable and sortable for expression properties

@azahnen azahnen requested a review from cportele September 5, 2024 14:51
@cportele
Copy link
Contributor

@azahnen

I have updated the sourcepath of abschnitteaeste/laenge_m in strassen to "[EXPRESSION]{sql=$T$.laenge+55}". Accessing the /strassen/collections/abschnitteaeste/items the following query is executed:

SELECT A.fid AS SKEY, A.abs, A.strbez, A.strkl, A.strnr, A.strzus, A.absnr, A.absast, A.statanf, SQL__1, A.vwbez, A.vwbezknz, datetime(A.netzstand), ST_AsText(ST_ForcePolygonCCW(A.geom)) FROM abschnitteaeste_line A WHERE (A.fid >= 1 AND A.fid <= 10) ORDER BY 1

The SQL__1 results in an error.

I have copied the "$T$." from the example above, but I do not understand what this means or if it is necessary. I have also tried it with {sql=laenge+55}, but the change had no effect on the behavior.

@azahnen azahnen mentioned this pull request Sep 30, 2024
3 tasks
@azahnen
Copy link
Collaborator Author

azahnen commented Sep 30, 2024

@cportele This was not implemented yet for GPKG.

@azahnen azahnen marked this pull request as ready for review September 30, 2024 08:30
@cportele
Copy link
Contributor

@azahnen - Expressions are now working as expected.

Do you have an example, where a left/right/full join makes sense? I could not come up with an example.

@azahnen
Copy link
Collaborator Author

azahnen commented Sep 30, 2024

@cportele After further thought, I don't think there is a use case for left/right/full join at the moment. The reason for that is that for every join a separate query will be generated. But there are plans for query optimizations where all joins for non-multiple properties would be merged into the main query. In that case the option would become meaningful.

So I still think it makes sense to introduce the option now and use it in the hale plugin to make the generated configurations future-proof in that regard. But it might be confusing to have an option without any current use case in the docs. So should we make it a hidden option for now?

@cportele
Copy link
Contributor

@azahnen - Yes, I think we should hide this option, at least for now.

@azahnen
Copy link
Collaborator Author

azahnen commented Sep 30, 2024

@cportele I removed the docs paragraph for the option.

@azahnen azahnen merged commit 56038bd into master Sep 30, 2024
@azahnen azahnen deleted the advanced-sql branch September 30, 2024 12:05
@azahnen azahnen mentioned this pull request Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants