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

Accessing table(collection) from directly client. #3

Open
bilinenkisi opened this issue Jan 19, 2023 · 0 comments
Open

Accessing table(collection) from directly client. #3

bilinenkisi opened this issue Jan 19, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@bilinenkisi
Copy link
Member

bilinenkisi commented Jan 19, 2023

For example:

from surrealpy.ws import SurrealClient, SurrealClientThread
from surrealpy.ws.models import LoginParams
from surrealpy.builder import Table
from typing import Union

# Create a new client to connect to SurrealDB
# You can use SurrealClientThread for thread-safe client
client: Union[SurrealClient  SurrealClientThread] = SurrealClient("http://localhost:9000/rpc") 


client.connect()

client.login(LoginParams(username="test",password="test"))

client.use(namespace="test",database="test")

users: Table = client["users"] # Will return an instance of table which initialize with "users" parameter (e.g: Table("users"))

The implementation will depend on pymongo collection system

@bilinenkisi bilinenkisi converted this from a draft issue Jan 19, 2023
@bilinenkisi bilinenkisi added the enhancement New feature or request label Jan 19, 2023
@bilinenkisi bilinenkisi changed the title pymongo like table access will be added pymongo like table(collection) access will be added Jan 19, 2023
@bilinenkisi bilinenkisi changed the title pymongo like table(collection) access will be added pymongo like table(collection) access Jan 19, 2023
@bilinenkisi bilinenkisi changed the title pymongo like table(collection) access Accessing table(collection) from directly client. Jan 19, 2023
@bilinenkisi bilinenkisi self-assigned this Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 📋 Todo
Development

No branches or pull requests

1 participant