MCPcopy
hub / github.com/django/django / raw

Method raw

tests/select_for_update/tests.py:620–639  ·  tests/select_for_update/tests.py::SelectForUpdateTests.raw
(status)

Source from the content-addressed store, hash-verified

618 self.start_blocking_transaction()
619
620 def raw(status):
621 try:
622 list(
623 Person.objects.raw(
624 class="st">"SELECT * FROM %s %s"
625 % (
626 Person._meta.db_table,
627 connection.ops.for_update_sql(nowait=True),
628 )
629 )
630 )
631 except DatabaseError as e:
632 status.append(e)
633 finally:
634 class="cm"># This method is run in a separate thread. It uses its own
635 class="cm"># database connection. Close it without waiting for the GC.
636 class="cm"># Connection cannot be closed on Oracle because cursor is still
637 class="cm"># open.
638 if connection.vendor != class="st">"oracle":
639 connection.close()
640
641 status = []
642 thread = threading.Thread(target=raw, kwargs={class="st">"status": status})

Calls 3

for_update_sqlMethod · 0.80
appendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected