Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Sqlite3 Browser
-
Hi All,
I thought I would share something that I have been working on and off for a week or so now, it is a sqlite3 browser. I have been trying to teach my self python and this is currently a very much work in progress so please ignore the quality of the code etc.
The file browser is currently only set to show files with the extension db, but that can be changed.
I have only tested this with the 1.6 beta but I don't think I have used anything that would stop it working with 1.5
The code is available here so please share any comments or suggestion you have.
I did just want to mention that pythonista is a great application and I wanted to thank @omz for it. -
@shaun-h This is a cool tool and I have been using it a lot lately to understand sqlite tables.
Based on studying it, I created a few utility functions that might be of use... https://github.com/cclauss/Ten-lines-or-less/blob/master/sqlite_get_list_from_table.py converts an sqlite database table into a list of namedtuples or a dict of namedtuples. Thanks for the inspiration!
-
Thanks, I am glad someone found some use from it.
I have a few more features I want to add to it in the near future when I get some time. Like the ability to run your own queries and create tables/views etc, so I will take a look at the utilities functions you have created, they might come in handy.
If you do have any suggestions for features or just thoughts please let me know. -
https://github.com/cclauss/sql_o_matic moves an sqlite database into a series of lists or dicts which contain namedtuples which match the columns of each table. Probably not a good idea for huge databases but it is quite useful for understanding databases that will fit in RAM.
-
Hi shaun-h,
your sqlite3 browser looks great and it's working fine with Pythonista 1.5 btw.
Maybe you think about showing the current relative path in the file browser (e.g. in view.name) and don't hiding the eXit button. And I hope you have time to implement the new features (queries, ...) that would be awesome. -
thanks @brumm I have been meaning to get back to it, I have been getting a bit distracted with istaflow which is on my github at the moment,.
I do have queries, and some more "wizard" like features to help create tables, databases, etc on the list if you have any ideas for feature happy to take them on board.
I will take a look at showing the current relative path in view.name that is a good idea. -
A little nifty code I wrote to show the current working directory in the file browser. It works by pasting into class FilebrowserController in filebrowser.py. Tell me what you think :)
def tableview_title_for_header(self, tableview, section): lst = str(os.getcwd()).split("/") for idx, item in enumerate(lst): if len(item) > 20: item = item[:20]+".." lst[idx] = item if len(lst) > 3: return "../"+"/".join(lst[-3:]) else: return "/".join(lst)