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

A proposed SQLite data access layer (DAL) #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

mahmoud
Copy link
Owner

@mahmoud mahmoud commented Nov 22, 2015

NB: This is a staged pull request, full of bad code (hence the branch name), so that we can see how some Python antipatterns manifest. I'll be playing the part of both the submitter and the reviewer, but the submitter (starting with the message following the italics) will write in quotes.

"I really like the LineDAL's JSONLines approach, and saw there was a stubbed out version of a SQLite implementation, so I am submitting this proposed implementation. I'm new to Python, so please let me know what you think."

@mahmoud
Copy link
Owner Author

mahmoud commented Nov 22, 2015

Wow! Thank you! Unfortunately, as it stands, I see many issues with this code. The interface is correct, but there are many antipatterns in play that would hurt immediate usability, as well as long-term maintainability. Please see my comments inline.

Overall a good effort, though, and if you make the changes in future PRs, your code is sure to be accepted! Thanks again!

"""

import os
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be an unused import, and while built-in, can set the wrong expectation for the following code.


class SQLiteDAL(object):
_extension = '.db'

__file_path = None
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike Java and C++, class instance members do not need class-level declarations. extension is a true class-level attribute, but this attribute is destined to be overridden in __init__. This line should be removed.

@mahmoud mahmoud changed the title A proposed SQLite DAL A proposed SQLite data access layer (DAL) Apr 14, 2016
Repository owner locked and limited conversation to collaborators Apr 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant