TomMalkin / SimQLe

The simplest way to use SQL in Python
MIT License
30 stars 5 forks source link

Add a default parameter option to the .connections.yaml file #18

Closed TomMalkin closed 5 years ago

TomMalkin commented 5 years ago

This way SimQLe can know which connection to use when no con_name is specified in either recordset() or execute_sql(), and save the user time, especially when dealing with only one connection in a project.

ZackBotkin commented 5 years ago

Hey. so it looks like you've got a number of issues that people can work on. I've forked your code and am using this branch

https://github.com/ZackBotkin/SimQLe/tree/hack

to kind of play around/hack. One thing I noticed.. you don't really seem to use classes or any sort of object oriented style. I find it really helps the maintainability of the project. You can check out my branch to see what I am doing, and I'll send you a pull request when done.

My goal with the refactor is to have a "Provider" that will take actual sql strings. possibly sanitize them, and then pass that off to the "ConnectionManager" which will open/close connections, read the config file, talk to the database... stuff like that.

That way, when we add a new database type, we just have to either modify or better yet, subclass ConnectionManager

ZackBotkin commented 5 years ago

Once I kind of get my feet wet with the code/idea, I could take any of these issues.

TomMalkin commented 5 years ago

Interesting - if you think it would be easier to maintain then I am all for it! Would these be singleton classes mainly? I'm not entirely sure how you intend to do this so I'm looking forward to seeing your PR.

Regarding this particular issue - it should be a very easy change to simply add a default: true option to the connections file that is selected when no con_name is defined when calling recordset() or execute_sql() - happy for anyone to submit a pr :)

TomMalkin commented 5 years ago

closed in #45 and released in #46