S
S
SashaN692021-04-18 14:31:08
Python
SashaN69, 2021-04-18 14:31:08

sqlite to aiosqlite?

import sqlite3
import os.path

class Sql:

    def __init__(self, database):
        BASE_DIR = os.path.dirname(os.path.abspath(__file__))
        db_path = os.path.join(BASE_DIR, "db.db")
        self.connection = sqlite3.connect(db_path)
        self.cursor = self.connection.cursor()

    def task_result(self):
        self.cursor.execute(f"""SELECT welcome FROM welcome """)
        message = self.cursor.fetchone()[0]
        return message

        def close(self):
            self.connection.close()

How it is possible to transfer it under aiosqlite? aiosqlite

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2021-04-18
@dimonchik2013

like this
https://www.programcreek.com/python/example/113483...
but not everything there should be considered good code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question