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

v.db.select: Add column names and types to JSON #3090

Merged
merged 2 commits into from
Jul 19, 2023

Conversation

wenzeslaus
Copy link
Member

The JSON output now has column names and types under info/columns.

The example in documentation does not include the unclear note about booleans (perhaps a discussion for another place).
A command to reproduce the example output is now included.

Documentation and test of the new functionality are included.

The JSON output now has column names and types under info/columns.

The example in documentation does not include the unclear note about booleans (perhaps a discussion for another place).
A command to reproduce the example output is now included.

Documentation and test of the new functionality are included.
@wenzeslaus
Copy link
Member Author

List of column names in Python are obtained by:

column_names = [item["name"] for item in data["info"]["columns"]]

Is this good? Convenient enough?

wenzeslaus added a commit to wenzeslaus/grass that referenced this pull request Jul 18, 2023
…s checks. Now depends on v.db.select producing the list of column names OSGeo#3090. Test and example included.
@wenzeslaus wenzeslaus added this to the 8.4.0 milestone Jul 18, 2023
@cwhite911
Copy link
Contributor

List of column names in Python are obtained by:

column_names = [item["name"] for item in data["info"]["columns"]]

Is this good? Convenient enough?

Do you plan on including any other information in info, such as, record count, layer name, query, group by, and null value?

@wenzeslaus
Copy link
Member Author

Do you plan on including any other information in info, such as, record count, layer name, query, group by, and null value?

Not now, but in the future, yes. I was thinking about including output of the bounding box flag (-r Print minimal region extent of selected vector features instead of attributes). That would go on the top level next to info and records.

Record count would make sense. I would avoid repeating random inputs unless we want to start including provenance.

I guess this suggests that info should be skipped.

I was also thinking about including column_names as an additional info, but that can be done on the top level as well.

@cwhite911
Copy link
Contributor

If the plan is to include more to info in the future I would include it now to avoid any backwards compatibility issues.

@wenzeslaus
Copy link
Member Author

Okay, thanks. I guess it's not strong either way, but I'll keep it as is. The format is flexible enough and we can change it later too with some temporary duplication cost.

@wenzeslaus
Copy link
Member Author

This has tests, documentation, and the design seems reasonable. I'm merging it.

@wenzeslaus wenzeslaus merged commit 719672d into OSGeo:main Jul 19, 2023
19 checks passed
@wenzeslaus wenzeslaus deleted the column_info_for_v_db_select branch July 19, 2023 13:51
@wenzeslaus wenzeslaus added the C Related code is in C label Jul 19, 2023
wenzeslaus added a commit to wenzeslaus/grass that referenced this pull request Jul 19, 2023
…s checks. Now depends on v.db.select producing the list of column names OSGeo#3090. Test and example included.
landam pushed a commit to landam/grass that referenced this pull request Oct 25, 2023
The JSON output now has column names and types under info/columns.

The example in documentation does not include the unclear note about booleans (a discussion for another place).

A command to reproduce the example output is now included.

Documentation and test of the new functionality are included.
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
The JSON output now has column names and types under info/columns.

The example in documentation does not include the unclear note about booleans (a discussion for another place).

A command to reproduce the example output is now included.

Documentation and test of the new functionality are included.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants