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

馃摎 Documentation: Better Readability of the Python SDK create Database #5582

Closed
2 tasks done
akashgreninja opened this issue May 25, 2023 · 3 comments
Closed
2 tasks done

Comments

@akashgreninja
Copy link

馃挱 Description

The syntax of the code you provided seems to have a minor error. Instead of using parentheses to wrap the client object and chaining the method calls, you can use backslashes "" to continue the lines for better readability. Here's the corrected code:
better appwrite

from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client() \
    .set_endpoint('https://cloud.appwrite.io/v1')  # Your API Endpoint \
    .set_project('5df5acd0d48c2')  # Your project ID \
    .set_key('919c2d18fb5d4...a2ae413da83346ad2')  # Your secret API key

databases = Databases(client)

result = databases.create('[DATABASE_ID]', '[NAME]')

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@gewenyu99
Copy link

gewenyu99 commented May 25, 2023

Hi, thanks for bringing this up. What your suggesting will result in this:

/*/PythonProject/venv/bin/python /*/test.py 
  File "/*/test.py", line 6
    .set_project('5df5acd0d48c2')  # Your project ID \
IndentationError: unexpected indent

Process finished with exit code 1

You can trail or append comments after or before backticks.

@akashgreninja
Copy link
Author


from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client() \
    .set_endpoint('https://cloud.appwrite.io/v1') \
    .set_project('5df5acd0d48c2') \
    .set_key('919c2d18fb5d4...a2ae413da83346ad2')  

databases = Databases(client)

result = databases.create('[DATABASE_ID]', '[NAME]')

sorry this is the better code

@gewenyu99
Copy link


from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client() \
    .set_endpoint('https://cloud.appwrite.io/v1') \
    .set_project('5df5acd0d48c2') \
    .set_key('919c2d18fb5d4...a2ae413da83346ad2')  

databases = Databases(client)

result = databases.create('[DATABASE_ID]', '[NAME]')

sorry this is the better code

Comments are important here for us. While this is definitely better looking code, I think it's less useful for readers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants