Here are the examples of the python api sqlalchemy.exc.NoResultFound taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
3
Source : test_result.py
with MIT License
from sqlalchemy
with MIT License
from sqlalchemy
def test_scalars_plus_one_none(self):
result = self._fixture(num_rows=0)
result = result.scalars()
assert_raises_message(
exc.NoResultFound,
"No row was found when one was required",
result.one,
)
def test_one_none(self):
3
Source : test_result.py
with MIT License
from sqlalchemy
with MIT License
from sqlalchemy
def test_one_none(self):
result = self._fixture(num_rows=0)
assert_raises_message(
exc.NoResultFound,
"No row was found when one was required",
result.one,
)
def test_one_or_none(self):
3
Source : test_engine_py3k.py
with MIT License
from sqlalchemy
with MIT License
from sqlalchemy
async def test_one_no_result(self, async_engine):
users = self.tables.users
async with async_engine.connect() as conn:
result = await conn.stream(
select(users).where(users.c.user_name == "nonexistent")
)
with expect_raises_message(
exc.NoResultFound, "No row was found when one was required"
):
await result.one()
@async_test
0
Source : datasource_api.py
with Apache License 2.0
from HEPCloud
with Apache License 2.0
from HEPCloud
def get_last_generation_id(self, taskmanager_name, taskmanager_id=None):
"""
Return last generation id for current task manager
or taskmanager w/ task_manager_id.
Args:
taskmanager_name (str): name of taskmanager to retrieve
taskmanager_id (str/uuid): id of taskmanager to retrieve
Returns:
int: the largest generation stored within the database
"""
with self.session() as session:
query = (
session.query(sql.func.max(db_schema.Dataproduct.generation_id).label("generation_id"))
.join(db_schema.Taskmanager)
.filter(db_schema.Taskmanager.name == taskmanager_name)
)
if taskmanager_id:
query = query.filter(db_schema.Taskmanager.taskmanager_id == taskmanager_id)
result = query.scalar()
if result is None:
raise NoResultFound("No matching entries found")
return result
def insert(self, taskmanager_id, generation_id, key, value, header, metadata):