How to use the aiosql.from_path function in aiosql

To help you get started, we’ve selected a few aiosql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nackjicholson / aiosql / tests / test_asyncpg.py View on Github external
def queries():
    dir_path = Path(__file__).parent / "blogdb/sql"
    return aiosql.from_path(dir_path, "asyncpg")
github nackjicholson / aiosql / tests / test_sqlite3.py View on Github external
def queries():
    p = Path(__file__).parent / "blogdb" / "sql"
    return aiosql.from_path(p, "sqlite3")
github nackjicholson / aiosql / tests / test_aiosqlite.py View on Github external
def queries():
    dir_path = Path(__file__).parent / "blogdb/sql"
    return aiosql.from_path(dir_path, "aiosqlite")
github nackjicholson / aiosql / tests / test_psycopg2.py View on Github external
def queries():
    dir_path = Path(__file__).parent / "blogdb" / "sql"
    return aiosql.from_path(dir_path, "psycopg2")
github nackjicholson / aiosql / example / example.py View on Github external
class UserBlog(NamedTuple):
    blogid: int
    author: str
    title: str
    published: datetime

    def __post_init__(self):
        self.published = datetime.strptime(self.publised, "%Y-%m-%d %H:%M")


dir_path = Path(__file__).parent
sql_path = dir_path / "sql"
db_path = dir_path / "exampleblog.db"
queries = aiosql.from_path(
    dir_path / "sql", "sqlite3", record_classes={"User": User, "UserBlog": UserBlog}
)


users = [("bobsmith", "Bob", "Smith"), ("johndoe", "John", "Doe"), ("janedoe", "Jane", "Doe")]
blogs = [
    (
        1,
        "What I did Today",
        """\
I mowed the lawn, washed some clothes, and ate a burger.

Until next time,
Bob""",
        "2017-07-28",
    ),