You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use your package with Sandman 2 and I was wondering if you were aware of any examples that use both packages ? I was wondering if there were any examples using the client fixture from pytest-flask and db_session or db_engine from your package.
Extending the example from the documentation I am pre-populate an empty database as below :
@pytest.fixture()
def session(db_session):
db_session.add(Table(id=0, name="test"))
db_session.commit() # This triggers an error
return db_session
def test_FUNCTION(client, session):
client.post(/some/path/, data={"name":"testing"})
record = session.query(Table).get(1)
assert record.name == "testing"
I find that either the rollback mechanism is failing with the pymssql driver at the line with the commit.
Table 'table' does not have the identity property. Cannot perform SET operation.DB-Lib error message 20018, severity 16:\nGeneral SQL Server error: Check messages from the SQL Server\n
I was hoping you may have come across this before and might be able to provide me with the odd pointer, the full code is available through a testing branch; explained in issue #22.
Regards,
Carel van Dam
The text was updated successfully, but these errors were encountered:
Carelvd
changed the title
fixtures pre-populating the database
Pre-populating the database
Sep 20, 2019
The initial error was due to the create statement for the table in SQL; I hadn't set an index upon the table, Doing so resolved my original issue now I find that SQLAlchemy errors out as follows :
sqlalchemy.exc.InvalidRequestError: Object '<Table at 0x4c4a0f0>' is already attached to session '2' (this is '3')
The client also seems to hang in some scenarios when I try to GET/POST data. I also went through the other issues and Issues #12, #19 and #7 appear similar in nature to what I am trying.
Very strange. The first thing I'd want to rule out is some kind of SQL Server incompatibility. Seems like you worked on testing multiple database engines in #22 -- were you able to reproduce the most recent error in Postgres?
Dear Ms. Cochrane,
I am trying to use your package with Sandman 2 and I was wondering if you were aware of any examples that use both packages ? I was wondering if there were any examples using the
client
fixture frompytest-flask
anddb_session
ordb_engine
from your package.Extending the example from the documentation I am pre-populate an empty database as below :
I find that either the rollback mechanism is failing with the
pymssql
driver at the line with the commit.I was hoping you may have come across this before and might be able to provide me with the odd pointer, the full code is available through a testing branch; explained in issue #22.
Regards,
Carel van Dam
The text was updated successfully, but these errors were encountered: