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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select request aren't updating #32

Closed
ianrtracey opened this issue Jun 25, 2021 · 4 comments
Closed

Select request aren't updating #32

ianrtracey opened this issue Jun 25, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@ianrtracey
Copy link
Contributor

Bug report

Describe the bug

Hey Team 馃憢

I am experiencing a strange issue where I am getting stale results when using the .select SQL function.

def does_signup_exist(phone_number: str) -> Union[bool, None]:
    query = f"* from signups where phone_number = '{phone_number}'"
    print(query)
    data = client.table("signups").select(query).execute()
    print(data)

I've changed the phone number several times but I still get back results despite certain phone numbers not existing. When I copy and paste the query into the interactive Supbase SQL console in the browser I get a different result than the client.

To Reproduce

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

  1. Query for a result, r1, using the syntax seen above
  2. Query for a different result, r2, using the syntax seen above
  3. Observe the results r1 == r2

Expected behavior

New result r2 should be updated based on the new query

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: [e.g. macOS, Windows]
  • 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.

@ianrtracey ianrtracey added the bug Something isn't working label Jun 25, 2021
@dreinon
Copy link
Contributor

dreinon commented Jun 28, 2021

I don't think you can execute a SQL query directly. This is due to security reasons, mainly, to prevent SQL Injection.
You can read JS Client docs on how to use them.

I haven't tried it but I think you might want to do the following:

client.table("signups").select('*').eq('phone_number', f'{phone_number}').execute()

@dreinon
Copy link
Contributor

dreinon commented Oct 6, 2021

@ianrtracey did I solved your doubts??

@dreinon
Copy link
Contributor

dreinon commented Oct 28, 2021

@J0 this should be closed due to inactivity and it was an issue of the user wrongly using the api.

@J0
Copy link
Collaborator

J0 commented Oct 30, 2021

Hey @ianrtracey,

We are closing this due to inactivity, please let us know if you're still facing any issues!

Thanks!

@J0 J0 closed this as completed Oct 30, 2021
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

3 participants