Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot insert a Decimal #967

Open
2 tasks done
rdong8 opened this issue Oct 16, 2024 · 0 comments
Open
2 tasks done

Cannot insert a Decimal #967

rdong8 opened this issue Oct 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rdong8
Copy link

rdong8 commented Oct 16, 2024

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

A clear and concise description of what the bug is.

Attempting to insert a decimal.Decimal results in this error:

TypeError: Object of type Decimal is not JSON serializable"

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

from decimal import Decimal

from supabase import create_async_client

async def main() -> None:
    client = await create_async_client(...)
    await (
        client
        .from_("test")
        .upsert({'percentage': Decimal(0.5)})
        .execute()
    )

asyncio.run(main())

Expected behavior

A clear and concise description of what you expected to happen.

The Decimal is inserted as is done by psycopg2.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: [e.g. macOS, Windows] Linux
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

@rdong8 rdong8 added the bug Something isn't working label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant