View Issue Details

IDProjectCategoryView StatusLast Update
0001461SymmetricDSImprovementpublic2025-04-30 17:20
Reporterrotten Assigned To 
Prioritynormal 
Status confirmedResolutionopen 
Product Version3.5.9 
Summary0001461: dbexport --sql column filter
DescriptionIf I run dbexport --sql with a selection query that does not select all of the columns in the table, dbexport will generate a CSV with all of the columns in the original table, and simply not populate the columns I didn't select.

I'd rather the CSV only contained the columns I selected. Is that something that can be added as a flag or property? Or maybe simply made the default behaviour when --sql is used?

I'm exporting tables to third parties who do not need all of the columns. Rather than shipping them empty columns, I'd like to ship them what they need without having to post-process the CSV.
Steps To Reproducecreate table (a, b, c, d)
insert some values in all 4 columns.

dbexport --sql 'select a,b from table'

Note that the csv has

a,b,c,d
with only a,b with values.
Tagsdbimport/dbexport

Activities

aifaniyi

2025-04-29 11:54

reporter   ~0002851

It appears dbexport will work as expected for the scenario above if you add the fields you do not require to the "--exclude-columns" list of fields i.e

dbexport --sql 'select a,b from table' --exclude-columns 'c,d'

should produce a csv file with just

cquamme

2025-04-30 17:20

developer   ~0002854

It seems like it's using the table metadata, and it should be using the result set metadata.

Issue History

Date Modified Username Field Change
2013-10-31 19:06 rotten New Issue
2019-04-22 14:18 elong Tag Attached: dbimport/dbexport
2024-07-03 17:28 jvanmeter Status new => confirmed
2025-04-29 11:54 aifaniyi Note Added: 0002851
2025-04-30 17:20 cquamme Note Added: 0002854