Junior — Middle
Have you had practical experience creating applications without using ORM solutions?
sobes.tech AI
Answer from AI
Yes, creating applications without ORM is possible and sometimes justified, especially if maximum control over SQL queries or high performance is required.
In such cases, the developer writes SQL queries manually using database libraries, such as psycopg2 for PostgreSQL or sqlite3 for SQLite. This allows precise control over the query structure and optimization.
An example of a simple query without ORM in Python using sqlite3:
import sqlite3
conn = sqlite3.connect('example.db')
cursor = conn.cursor()
cursor.execute('SELECT * FROM users WHERE age > ?', (30,))
rows = cursor.fetchall()
for row in rows:
print(row)
conn.close()
This approach requires more manual work but offers flexibility and transparency.