Questions tagged [orm]
Object-relational mapping (ORM) is a technique for mapping object-oriented systems to relational databases.
22
questions
0
votes
0
answers
64
views
Looking for best practices/design patterns when working with SqlAlchemy ORM
I am new to python and sqlalchemy and looking for help to cleanup below code or follow a popular design pattern when working with database.
Below sample code is for the use case "User clicks on ...
1
vote
0
answers
106
views
write a wrapper for cosmos db calls to use the results as objects in python (technically an ORM)
As part of a larger program, I'm trying to find the cleanest way to architecture my program to query a cosmos db and use its return values (dict objects) as easy to manipulate and maintain objects in ...
2
votes
1
answer
80
views
Object relational mapper - optimize in memory data representation and code improvements
An Object-relational mapper built using php.
This was done for educational purposes, and curious to know what kind of improvement has to be done to use in production.
Please refer to the complete ...
-1
votes
1
answer
160
views
django multiple if else refactor
I have a function with multiple if else statements that I'm trying to simplify in Django
Is there a pattern or maybe a better modeling approach that I could use here?
The idea behind is to have a ...
3
votes
1
answer
106
views
Flask Database Design with ORM
I am designing a Stock Currency application and for that, I created a database.
I searched for my question here first but the answerer told me to ask the same question here.
...
1
vote
0
answers
17
views
SequelizeJS: Abstraction of the ORM
I'm learning how to use SequelizeJS.
What i found was that (at least for me) the definition of the DB model was too invasive in my code when creating object.
I was thinking that the user of your model ...
2
votes
0
answers
1k
views
Providing different __table_args__ to SQLAlchemy mapped class depending on backend DBMS
I need to set different __table_args__ for the mapped class depending on the backend DBMS, e.g. mssql and ...
2
votes
1
answer
444
views
Rails model for aggregate data instead of a real table
I have a rails app with a Project model. Each project has usages which is numeric data.
I need to get all the usage for each month and year. I also need to get usage for specific months and years ...
1
vote
0
answers
120
views
Database connector in Python
I've been trying to build an ORM. I started with the connector layer, which is responsible for the database server connections and executes raw SQL as the code below shows.
I have built the ...
2
votes
0
answers
51
views
Sharing model for different ORM's
I am building a MySQL to Realmdb converter app.
I use Entity Framework to deal with MySQL, so below is the code of one of my model classes. I don't want to have multiple classes representing the same ...
7
votes
3
answers
2k
views
Unit testing a REST API in Go
I am learning Go by writing a simple CRUD REST API using gotilla/mux and Gorm.
I would like to get some feedback on the application code and on unit tests in particular. Please suggest me what to ...
3
votes
1
answer
103
views
PHP - Saving inbound email and its attachment
I have the below code, which handles inbound emails in my application, saves the actual email content (text + attachments) to my database, and the saves the actual attachment files on the server.
In ...
3
votes
0
answers
8k
views
Mapping Entities to DTOs in TypeScript
In a recent project my backend architecture consists of
Repositories (talking to database)
Services (handling business logic)
<...
3
votes
0
answers
656
views
GUI to control a NZXT cooling and lighting system
I am working since a couple of weeks on my first Python application and I would love to have a review of the code I wrote so far.
The app has the purpose of controlling the cooling and lighting of an ...
2
votes
1
answer
68
views
Displaying a user profile based on a mock ORM
Overview
We are learning PHP OOP and decided to create a simple app with 3 database tables, one a basic users table, the other two containing information about the users' favorite food and favorite ...
2
votes
1
answer
673
views
Password field based on peewee ORM framework
I implemented a password field based on the peewee framework to handle passwords of accounts in web applications for Python 3.4.
My goals were
Secure hashing.
No plain password leakage.
Easy ...
0
votes
1
answer
51
views
Is using beforeFind() event in background to dynamic update SQL queries a good practice? [closed]
I have a Projects table, which I need to ORDER BY code column. But problem is ...
3
votes
0
answers
358
views
Flask-SQLAlchemy model structure
I'm seeking a review of my Flask-SQLAlchemy model structure, particularly adherence to DB best practices, such as avoiding duplication, etc.
The models represent the relations between Departments, ...
5
votes
0
answers
2k
views
Implementing an enum field for peewee.Model
I implemented an enum field class EnumField inheriting from peewee.CharField.
The reason that I use a character-based field is ...
3
votes
0
answers
848
views
Implementing a JSON-serializable ORM model
I implemented a library which, amongst other things, implements a JSON-serializable ORM model based on the peewee framework.
Here's the relevant excerpt:
...
6
votes
2
answers
9k
views
Building a simple ORM in PHP
I have been curious about how ORMs really work under the hood so I decided to do something simple in PHP.
So I basically built two Interfaces: DatabaseInterface and the ORMMapper interface and two ...
5
votes
3
answers
3k
views
A demonstrational example of a Data mapper ORM
I want to create an educational example of a Data mapper type ORM. You know, it is always interesting to know how the stuff works, but when you take a fully functional software package, it's just ...