slackapi / python-slack-sdk

Slack Developer Kit for Python
https://tools.slack.dev/python-slack-sdk/
MIT License
3.86k stars 834 forks source link

Add asyncio support to SQLAlchemy based InstallationStore/StateStore #1276

Open melvinkcx opened 2 years ago

melvinkcx commented 2 years ago

Hi, I'm trying to use AsyncOAuthSettings with SQLAlchemyOAuthStateStore. However, I stumbled upon this error and found out that SQLAlchemyOAuthStateStore doesn't support async operations:

  File "/usr/local/lib/python3.10/site-packages/slack_bolt/oauth/async_oauth_flow.py", line 167, in handle_installation
    state = await self.issue_new_state(request)
  File "/usr/local/lib/python3.10/site-packages/slack_bolt/oauth/async_oauth_flow.py", line 194, in issue_new_state
    return await self.settings.state_store.async_issue()
AttributeError: 'SQLAlchemyOAuthStateStore' object has no attribute 'async_issue'

I wonder if there are any plans to support this in near future?

Category (place an x in each of the [ ])

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

seratch commented 2 years ago

Hi @melvinkcx, thanks for writing in!

This sounds a great addition in the future! However, since the asyncio support in SQLAlchemy is still in beta, we are not planning to add asyncio support in the short term. Once the built-in asyncio support in SQLAlchemy is GAed, we are happy to add the support on this SDK side.

For now, you may want to reuse the example code here. If you are fine to use databases, which is a different library relying on SQLAlchemy, the implementation should work well for you.

KeiichiHirobe commented 5 months ago

Hi @seratch It seems that built-in asyncio support in SQLAlchemy has reached GA status in version 2.0.

I noticed that you still support 1.4.3, so you might not support asyncio in this SDK yet. However, it would be greatly appreciated if you could add support for it when you stop supporting 1.4.3.