Junior — Middle
Have you had experience interacting with a database without using intermediate layers or ORM?
sobes.tech AI
Answer from AI
Yes, I have experience working with databases without ORM or middleware layers, often using direct SQL queries through libraries like sqlite3 or psycopg2 in Python. This approach requires manually writing SQL queries, managing connections, and processing results.
Example of a simple SQLite query without ORM:
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 gives full control over queries but requires more code and attention to security (e.g., SQL injection protection).