supabase-py icon indicating copy to clipboard operation
supabase-py copied to clipboard

feat: setting timeout for postgrest-py client

Open keosariel opened this issue 3 years ago • 7 comments
trafficstars

postgrest-py accepts a timeout parameter from v0.8.0

Added thetimeout option for the postgrest client and made it optional, with a defaulf of 5sec.

@anand2312 @J0 @dreinon @leynier Closes #225

keosariel avatar Jul 15 '22 14:07 keosariel

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.63%.

Quality metrics Before After Change
Complexity 1.70 ⭐ 1.97 ⭐ 0.27 👎
Method Length 35.07 ⭐ 37.40 ⭐ 2.33 👎
Working memory 6.80 🙂 7.25 🙂 0.45 👎
Quality 80.09% 78.46% -1.63% 👎
Other metrics Before After Change
Lines 221 233 12
Changed files Quality Before Quality After Quality Change
supabase/client.py 82.48% ⭐ 82.09% ⭐ -0.39% 👎
supabase/lib/client_options.py 65.59% 🙂 61.24% 🙂 -4.35% 👎
tests/test_client_options.py 85.32% ⭐ 84.00% ⭐ -1.32% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
supabase/lib/client_options.py ClientOptions.replace 8 ⭐ 92 🙂 12 😞 58.64% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

sourcery-ai[bot] avatar Jul 15 '22 14:07 sourcery-ai[bot]

Closes #225 Edit: Whoops that didnt't work as I expected -- can you edit your PR description and add Closes #225 to it so that the issue is linked with this PR please?

anand2312 avatar Jul 15 '22 15:07 anand2312

Closes #225 Edit: Whoops that didnt't work as I expected -- can you edit your PR description and add Closes #225 to it so that the issue is linked with this PR please?

okay sure!

keosariel avatar Jul 15 '22 18:07 keosariel

Is there an update on this PR? Alternatively how can I adjust the timeout for the client in the mean time? I've tried the methods prescribed here, but I'm still hitting a 5s timeout (it's preventing me from querying any data from a large view)

mohnish7 avatar Jul 20 '22 12:07 mohnish7

Hey could we trouble you to run isort And black so the tests pass as well?

Thanks!

J0 avatar Jul 21 '22 02:07 J0

Is there an update on this PR? Alternatively how can I adjust the timeout for the client in the mean time? I've tried the methods prescribed here, but I'm still hitting a 5s timeout (it's preventing me from querying any data from a large view)

Hey man, If there is any issue then it coming from the postgrest-py lib. All I have done is updated the code to pass a timeout argument to the postgrest-py client like you'd see here

keosariel avatar Jul 21 '22 20:07 keosariel

Codecov Report

Merging #234 (754bc06) into develop (3171a02) will increase coverage by 1.06%. The diff coverage is 100.00%.

:exclamation: Current head 754bc06 differs from pull request most recent head b1a73a0. Consider uploading reports for the commit b1a73a0 to get more accurate results

@@             Coverage Diff             @@
##           develop     #234      +/-   ##
===========================================
+ Coverage    80.00%   81.06%   +1.06%     
===========================================
  Files            8        8              
  Lines          125      132       +7     
===========================================
+ Hits           100      107       +7     
  Misses          25       25              
Impacted Files Coverage Δ
supabase/client.py 90.90% <100.00%> (+0.43%) :arrow_up:
supabase/lib/client_options.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3171a02...b1a73a0. Read the comment docs.

codecov[bot] avatar Jul 25 '22 07:07 codecov[bot]

Hey @keosariel,

Thanks for the PR! Appreciate the contribution as it helped greatly with getting the timeout setting across the line :) We've merged @mohnish7 's extension of this pull and will be closing this for now.

Let us know if you have any further questions/issues

J0 avatar Oct 10 '22 05:10 J0