I would like to write and test my SQL queries without connecting to an SQL database. Is that possible? Most examples connect to a mysql database, but the one I have to test against is a mssql.
As one can create these tables in sqlalchemy, can one not add data to them locally (before committing) and execute queries on them, such that one can assert that the queries work as expected?
from sqlalchemy import MetaData
metadata_obj = MetaData()
from sqlalchemy import Table, Column, Integer, String
user = Table(
"user",
metadata_obj,
Column("user_id", Integer, primary_key=True),
Column("user_name", String(16), nullable=False),
Column("email_address", String(60)),
Column("nickname", String(50), nullable=False),
)
No, it turns out that the standard way to do these tests are to place ones data in sqlite "in memory", and then make queries. It works pretty well, but it is not all functionality from MSSQL that is available in sqlite.