pawelsalawa / sqlitestudio

A free, open source, multi-platform SQLite database manager.
https://sqlitestudio.pl
Other
4.41k stars 553 forks source link

Add text file output #3849

Open Knotmyline opened 3 years ago

Knotmyline commented 3 years ago

Details

I need to output the results of a query, and only the results, to a file. No other formatting is needed. I want to be able to provide both the name and type to that file as well as assign the folder location for it.
I have all of the code written for this but am unable to create that file.
The current Export feature does not support this.

Please let me know if this is a feature you will soon add. I like SQLiteStudio a lot and hope to use it for this project.

Ron Hager knotmyline@gmail.com

pawelsalawa commented 3 years ago

Can you show example of how would you expect the data to be presented in that file? How columns and rows should be distinguished from each other?

Knotmyline commented 3 years ago
Thank you Pawel for your quick response. Here is an example from the Chinook database.The query of AlbumsSELECT AlbumId,Title,ArtistIdFROM albums; Produces this on the Results tab.On this view the column for AlbumId appears to have a length of 8 or 9 spaces as does ArtistId. The Title column size I cannot even guess. I can envision two options for output to text.Use the internal spacing of SQLStudio for this display grid (8 or 9 spaces or whatever is the actual amount Studio is using for display) for both AlbumId & ArtistId, and etc. for each column of the display grid.Another option would be to allow the user to define the length output of each column and then output the columns accordingly. There could be an option for a space or no space between columns. The example above shows some columns left adjusted and some right adjusted. That also may be a consideration for user control.For my project I have an input file of textual genealogy data that I am converting into a highly formatted HTML document. With unique headings, subheadings, color, and such. I use SQL to build temporary working db’s, reformat the input, encode new fields based on the input, sort, and generate lines of HTML and CSS code. My test file currently produces an additional 64 lines more than the input file. My final output is only one column but I can envision a project that would use multiple columns. When completed I plan on distributing the final query to the genealogical community that use Roots Magic.   I hope this helps you in your decision on how this would be implemented.  Ron Hager   From: Paweł SalawaSent: Sunday, October 4, 2020 2:34 AMTo: pawelsalawa/sqlitestudioCc: Knotmyline; AuthorSubject: Re: [pawelsalawa/sqlitestudio] Add text file output (#3849) Can you show example of how would you expect the data to be presented in that file? How columns and rows should be distinguished from each other?—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
pawelsalawa commented 3 years ago

Try using Export, select "CSV" format and pick "whitespace" as separator, like this: image

For file name just enter the exact name (including extension) as you want. It will accept whatever extension you want. I think it will do what you need.

Knotmyline commented 3 years ago
It exports with quotes around the data. My browser, Chrome, does not recognize the HTML therein.  From: Paweł SalawaSent: Sunday, October 4, 2020 1:40 PMTo: pawelsalawa/sqlitestudioCc: Knotmyline; AuthorSubject: Re: [pawelsalawa/sqlitestudio] Add text file output (#3849) Try using Export, select "CSV" format and pick "whitespace" as separator, like this:For file name just enter the exact name (including extension) as you want. It will accept whatever extension you want.I think it will do what you need.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
pawelsalawa commented 3 years ago

I see. Okay, I'll keep this item for implementation.

Knotmyline commented 3 years ago
Thank you very much Pawel. Please let me know when it is available. Will you want me to assist in testing? Ron From: Paweł SalawaSent: Sunday, October 4, 2020 3:52 PMTo: pawelsalawa/sqlitestudioCc: Knotmyline; AuthorSubject: Re: [pawelsalawa/sqlitestudio] Add text file output (#3849) I see. Okay, I'll keep this item for implementation.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
pawelsalawa commented 3 years ago

Please be aware that it probably won't be done soon. I'm struggling with time and there are other, high priority tasks to be done in the project.

Knotmyline commented 3 years ago
Pawel, Further research seems to indicate that the quote issue lies with SQLite. Here is an article I found.  I will work within my SQLite code to see if I can resolve the issue there. Casting my one column to text may resolve the issue. I hope. If you have a different code fix, please let me know.  https://github.com/sqlitebrowser/sqlitebrowser/issues/1280   From: Paweł SalawaSent: Sunday, October 4, 2020 4:44 PMTo: pawelsalawa/sqlitestudioCc: Knotmyline; AuthorSubject: Re: [pawelsalawa/sqlitestudio] Add text file output (#3849) Please be aware that it probably won't be done soon. I'm struggling with time and there are other, high priority tasks to be done in the project.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.