Skip to content

asyncpg raising syntax error #940

Closed Answered by sinisaos
AmazingAkai asked this question in Q&A
Discussion options

You must be logged in to vote

@AmazingAkai You are mixing save and insert methods. You must use an insertmethod like this:

async def foo():
  poll = await Poll.insert(
    Poll(
        author_id=000000000000000000,
        channel_id=000000000000000000,
        question="Hello?",
        options=["Hi?", "Hey?"],
        votes=[[] for _ in choices],
    )
)

or you can use save method to save object like this:

async def foo():
   poll = Poll(
        author_id=000000000000000000,
        channel_id=000000000000000000,
        question="Hello?",
        options=["Hi?", "Hey?"],
        votes=[[] for _ in choices],
    )
    await poll.save()
)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AmazingAkai
Comment options

Answer selected by dantownsend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants