Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def queries():
dir_path = Path(__file__).parent / "blogdb/sql"
return aiosql.from_path(dir_path, "asyncpg")
def queries():
p = Path(__file__).parent / "blogdb" / "sql"
return aiosql.from_path(p, "sqlite3")
def queries():
dir_path = Path(__file__).parent / "blogdb/sql"
return aiosql.from_path(dir_path, "aiosqlite")
def queries():
dir_path = Path(__file__).parent / "blogdb" / "sql"
return aiosql.from_path(dir_path, "psycopg2")
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",
),