Skip to content

Instantly share code, notes, and snippets.

use futures::{Async, AsyncSink, Future, Sink};
use tokio::io::AsyncWrite;
use std::io;
pub struct ByteSink<W: AsyncWrite>(W);
impl<W: AsyncWrite> ByteSink<W> {
pub fn new(writer: W) -> Self {
ByteSink(writer)
@tkrajina
tkrajina / django_raw_sql_without_model.py
Last active November 27, 2023 18:55
Django raw sql without model
from django.db import connection
# If using cursor without "with" -- it must be closed explicitly:
with connection.cursor() as cursor:
cursor.execute('select column1, column2, column3 from table where aaa=%s', [5])
for row in cursor.fetchall():
print row[0], row[1], row[3]