This repository has been archived by the owner on Oct 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #499 from hotosm/feature/splitdb
Multi-database support
- Loading branch information
Showing
36 changed files
with
1,678 additions
and
826 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,4 @@ unconfig.h.in | |
**/__pycache__/ | ||
.vscode | ||
data | ||
data_osm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Results per page on raw featues queries | ||
RESULTS_PER_PAGE = 500 | ||
# Results per page on list featues queries | ||
RESULTS_PER_PAGE_LIST = 10 | ||
# Print debug messages | ||
DEBUG=False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,55 @@ | ||
#!/usr/bin/python3 | ||
# | ||
# Copyright (c) 2023, 2024 Humanitarian OpenStreetMap Team | ||
# | ||
# This file is part of Underpass. | ||
# | ||
# Underpass is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Underpass is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Underpass. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
def tagsQueryFilter(tagsQuery, table): | ||
query = "" | ||
tags = tagsQuery.split(",") | ||
keyValue = tags[0].split("=") | ||
|
||
if len(keyValue) == 2: | ||
query += "{0}.tags->>'{1}' ~* '^{2}'".format(table, keyValue[0], keyValue[1]) | ||
query += "{table}.tags->>'{key}' ~* '^{value}'".format( | ||
table=table, | ||
key=keyValue[0], | ||
value=keyValue[1] | ||
) | ||
else: | ||
query += "{0}.tags->>'{1}' IS NOT NULL".format(table, keyValue[0]) | ||
query += "{table}.tags->>'{key}' IS NOT NULL".format( | ||
table=table, | ||
key=keyValue[0] | ||
) | ||
|
||
for tag in tags[1:]: | ||
keyValue = tag.split("=") | ||
if len(keyValue) == 2: | ||
query += "OR {0}.tags->>'{1}' ~* '^{2}'".format(table, keyValue[0], keyValue[1]) | ||
query += "OR {table}.tags->>'{key}' ~* '^{value}'".format( | ||
table=table, | ||
key=keyValue[0], | ||
value=keyValue[1] | ||
) | ||
else: | ||
query += "OR {0}.tags->>'{1}' IS NOT NULL".format(table, keyValue[0]) | ||
query += "OR {table}.tags->>'{key}' IS NOT NULL".format( | ||
table=table, | ||
key=keyValue[0] | ||
) | ||
return query | ||
|
||
def hashtagQueryFilter(hashtag, table): | ||
return "'{0}' = ANY (hashtags)".format(hashtag) | ||
return "'{hashtag}' = ANY (hashtags)".format( | ||
hashtag=hashtag | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.