# Code generated by sqlc. DO NOT EDIT.
# versions:
#   sqlc v1.29.0
# source: _07_create_hyrex_task_def_table.sql
import dataclasses

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


CREATE_TASK_DEF_TABLE = """-- name: create_task_def_table \\:exec
CREATE TABLE IF NOT EXISTS hyrex_task_def
(
    task_name        TEXT NOT NULL PRIMARY KEY,
    cron_expr        TEXT,
    source_code      TEXT,
    arg_schema       JSON,
    queue            TEXT,
    priority         INTEGER,
    max_retries      INTEGER,
    timeout_seconds  INTEGER CHECK (timeout_seconds IS NULL OR timeout_seconds > 0),
    last_updated     TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
)
"""


@dataclasses.dataclass()
class CreateTaskDefTableParams:

    pass

class Querier:
    def __init__(self, conn: sqlalchemy.engine.Connection):
        self._conn = conn

    def create_task_def_table(self, arg: CreateTaskDefTableParams) -> None:
        self._conn.execute(sqlalchemy.text(CREATE_TASK_DEF_TABLE))


class AsyncQuerier:
    def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
        self._conn = conn

    async def create_task_def_table(self, arg: CreateTaskDefTableParams) -> None:
        await self._conn.execute(sqlalchemy.text(CREATE_TASK_DEF_TABLE))
