Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fedden committed Apr 5, 2021
1 parent b11118e commit 0e77c95
Showing 1 changed file with 50 additions and 28 deletions.
78 changes: 50 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

Supabase client for Python. This mirrors the design of [supabase-js](https://github.com/supabase/supabase-js/blob/master/README.md)

## Status
- [x] Alpha: We are testing Supabase with a closed set of customers
- [x] Public Alpha: Anyone can sign up over at [app.supabase.io](https://app.supabase.io). But go easy on us, there are a few kinks.
- [ ] Public Beta: Stable enough for most non-enterprise use-cases
- [ ] Public: Production-ready

We are currently in Public Alpha. Watch "releases" of this repo to get notified of major updates.

<kbd><img src="https://gitcdn.link/repo/supabase/supabase/master/web/static/watch-repo.gif" alt="Watch this repo"/></kbd>

## Installation

**Recomended:** First activate your virtual environment, with your favourites system. For example, we like `poetry` and `conda`!
Expand Down Expand Up @@ -41,12 +51,11 @@ from supabase_py import create_client, Client

url: str = os.environ.get("SUPABASE_URL")
key: str = os.environ.get("SUPABASE_KEY")
email = "[email protected]"
password = "password"
supabase: Client = create_client(url, key)
user = supabase.auth.sign_up(email, password)
```

Use the supabase client to interface with your database.

### Running Tests

Currently the test suites are in a state of flux. We are expanding our clients tests to ensure things are working, and for now can connect to this test instance, that is populated with the following table:
Expand Down Expand Up @@ -78,48 +87,61 @@ This is a sample of how you'd use supabase-py. Functions and tests are WIP
## Authenticate

```python
supabase.auth.sign_up({
"email": '[email protected]',
"password": 'example-password',
})
from supabase_py import create_client, Client

url: str = os.environ.get("SUPABASE_TEST_URL")
key: str = os.environ.get("SUPABASE_TEST_KEY")
supabase: Client = create_client(url, key)
# Create a random user login email and password.
random_email: str = "[email protected]"
random_password: str = "fqj13bnf2hiu23h"
user = supabase.auth.sign_up(email=random_email, password=random_password)
```

## Sign-in

```python
supabase.auth.signIn({
"email": '[email protected]',
"password": 'example-password',
})
from supabase_py import create_client, Client

url: str = os.environ.get("SUPABASE_TEST_URL")
key: str = os.environ.get("SUPABASE_TEST_KEY")
supabase: Client = create_client(url, key)
# Sign in using the user email and password.
random_email: str = "[email protected]"
random_password: str = "fqj13bnf2hiu23h"
user = supabase.auth.sign_in(email=random_email, password=random_password)
```

## Sign-in(Auth provider). This is not supported yet
## Managing Data

#### Insertion of Data
```python
supabase.auth.signIn({
// provider can be 'github', 'google', 'gitlab', or 'bitbucket'
"provider": 'github'
})
```
from supabase_py import create_client, Client

## Managing Data
url: str = os.environ.get("SUPABASE_TEST_URL")
key: str = os.environ.get("SUPABASE_TEST_KEY")
supabase: Client = create_client(url, key)
data = supabase.table("countries").select("*").execute()
assert len(data.get("data", [])) > 0
```

#### Selection of Data
```python
supabase
.from('countries')
.select("
name,
cities (
name
)
")
from supabase_py import create_client, Client

url: str = os.environ.get("SUPABASE_TEST_URL")
key: str = os.environ.get("SUPABASE_TEST_KEY")
supabase: Client = create_client(url, key)
data = supabase.table("countries").select("*").execute()
# Assert we pulled real data.
assert len(data.get("data", [])) > 0
```

## Realtime Changes

```python
mySubscription = supabase
.from('countries')
subscription = supabase
.table('countries')
.on('*', lambda x: print(x))
.subscribe()
```
Expand Down

0 comments on commit 0e77c95

Please sign in to comment.