]> git.ipfire.org Git - pbs.git/commitdiff
database: Allow to execute raw statements
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Jan 2025 14:24:28 +0000 (14:24 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Jan 2025 14:24:28 +0000 (14:24 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/database.py

index 353dc9a1e006fe6065c6e6bc07728ab873480416..d173d76f2a2317145799238c2775b62d612f03ed 100644 (file)
@@ -321,7 +321,7 @@ class Connection(object):
                # Mark it as deleted
                await session.delete(object)
 
-       async def _execute(self, stmt):
+       async def execute(self, stmt):
                """
                        Executes a statement and returns a result object
                """
@@ -340,7 +340,7 @@ class Connection(object):
                """
                        Fetches objects of the given type
                """
-               result = await self._execute(stmt)
+               result = await self.execute(stmt)
 
                # Process the result in batches
                if batch_size:
@@ -351,7 +351,7 @@ class Connection(object):
                        yield object
 
        async def fetch_one(self, stmt):
-               result = await self._execute(stmt)
+               result = await self.execute(stmt)
 
                # Return exactly one object or none, but fail otherwise
                return result.scalar_one_or_none()
@@ -378,7 +378,7 @@ class Connection(object):
                """
                        Returns the raw result after a SELECT statement
                """
-               result = await self._execute(stmt)
+               result = await self.execute(stmt)
 
                # Process mappings
                result = result.mappings()
@@ -390,7 +390,7 @@ class Connection(object):
                """
                        Returns exactly one row
                """
-               result = await self._execute(stmt)
+               result = await self.execute(stmt)
 
                # Process mappings
                result = result.mappings()