-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💪 Sentence fetching from database working
Turns out painful grinding of the docs was adequate to solve this immediate problem. This required an overhaul to now the models were being automaped. This overhaul will be applied to the rest of the tables in subsequent commits. Sentence fetching only works on infinitives and correctness at this point, but adding the remaining features shouldn't prove to be much of a problem later.
- Loading branch information
Showing
6 changed files
with
51 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import enum | ||
|
||
from sqlalchemy import inspect | ||
|
||
def object_as_dict(obj): | ||
return { | ||
c.key: getattr(obj, c.key) | ||
for c in inspect(obj).mapper.column_attrs | ||
} | ||
|
||
class DatabaseStringEnum(enum.Enum): | ||
|
||
def __str__(self): | ||
return self.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters