-
-
Notifications
You must be signed in to change notification settings - Fork 435
t.list: Add support for listing multiple dataset types #7731
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
2bf81a0
9380913
91035e8
ac3d6dd
eaf31d5
0957f85
50aef44
35ba70a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,31 +101,38 @@ def get_dataset_list( | |
|
|
||
| result = {} | ||
|
|
||
| for mapset in dbif.tgis_mapsets: | ||
| if temporal_type == "absolute": | ||
| table = type + "_view_abs_time" | ||
| else: | ||
| table = type + "_view_rel_time" | ||
|
|
||
| if columns and columns.find("all") == -1: | ||
| sql = "SELECT " + str(columns) + " FROM " + table | ||
| else: | ||
| sql = "SELECT * FROM " + table | ||
| for dtype in [t.strip() for t in type.split(",") if t.strip()]: | ||
| for mapset in dbif.tgis_mapsets: | ||
| if temporal_type == "absolute": | ||
| table = dtype + "_view_abs_time" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the intention is to be able to list all STDS in one go, should we not support also multiple / list input for temporal_type?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree and t.list already allows that, just not the function.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That probably means the temporal_type should always go into the JSON and CSV output too, no?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The temporal_type is already in CSV and JSON with columns=all, it could be added explicitly as one of the options, but I am not sure it's worth it. |
||
| else: | ||
| table = dtype + "_view_rel_time" | ||
|
|
||
| if columns and columns.find("all") == -1: | ||
| cols = [ | ||
| f"'{dtype}' AS type" if c.strip() == "type" else c.strip() | ||
|
saket0187 marked this conversation as resolved.
Outdated
|
||
| for c in str(columns).split(",") | ||
| ] | ||
| sql = "SELECT " + ", ".join(cols) + " FROM " + table | ||
| else: | ||
| sql = f"SELECT *, '{dtype}' AS type FROM {table}" | ||
|
|
||
| if where: | ||
| sql += " WHERE " + where | ||
| sql += " AND mapset = '%s'" % (mapset) | ||
| else: | ||
| sql += " WHERE mapset = '%s'" % (mapset) | ||
| if where: | ||
| sql += " WHERE " + where | ||
| sql += " AND mapset = '%s'" % (mapset) | ||
| else: | ||
| sql += " WHERE mapset = '%s'" % (mapset) | ||
|
|
||
| if order: | ||
| sql += " ORDER BY " + order | ||
| if order: | ||
| sql += " ORDER BY " + order | ||
|
|
||
| dbif.execute(sql, mapset=mapset) | ||
| rows = dbif.fetchall(mapset=mapset) | ||
| dbif.execute(sql, mapset=mapset) | ||
| rows = dbif.fetchall(mapset=mapset) | ||
|
|
||
| if rows: | ||
| result[mapset] = rows | ||
| if rows: | ||
| if mapset not in result: | ||
| result[mapset] = [] | ||
| result[mapset].extend(rows) | ||
|
|
||
| if connection_state_changed: | ||
| dbif.close() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.