Skip to content

Commit

Permalink
SK-1622: Scafolding for Python SDK V2
Browse files Browse the repository at this point in the history
  • Loading branch information
saileshwar-skyflow committed Sep 18, 2024
1 parent aebc314 commit 000ddcd
Show file tree
Hide file tree
Showing 92 changed files with 184 additions and 8 deletions.
16 changes: 8 additions & 8 deletions samples/README.md → v1/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pip install skyflow
this file secure, as You'll need it for each of the samples.

## The samples
### [Get data](./get_sample.py)
### [Get data](get_sample.py)

To retrieve data using Skyflow IDs or unique column values, use the `get(records: dict)` method. The `records` parameter takes a Dictionary that contains either an array of Skyflow IDs or a unique column name and values.

Expand All @@ -58,7 +58,7 @@ Replace the following values in the sample file:
```bash
python3 get_sample.py
```
### [Get data by ID](./get_by_ids_sample.py)
### [Get data by ID](get_by_ids_sample.py)

Get data using Skyflow IDs for the desired records.

Expand All @@ -83,7 +83,7 @@ python3 get_by_ids_sample.py
```


### [Update data](./update_sample.py)
### [Update data](update_sample.py)

Update data in the vault.

Expand All @@ -107,7 +107,7 @@ Replace the following values in the sample file:
python3 update_sample.py
```

### [Insert data](./insert_sample.py)
### [Insert data](insert_sample.py)

Insert data in the vault.

Expand All @@ -130,7 +130,7 @@ Replace the following values in the sample file:
python3 insert_sample.py
```

### [Detokenize data](./detokenize_sample.py)
### [Detokenize data](detokenize_sample.py)

Detokenize a data token from the vault. Make sure the specified token is for
data that exists in the vault. If you need a valid token, use
Expand All @@ -155,7 +155,7 @@ Replace the following values in the sample file:
python3 detokenize_sample.py
```

### [Invoke a connection](./invoke_connection_sample.py)
### [Invoke a connection](invoke_connection_sample.py)

Skyflow Connections is a gateway service that uses Skyflow's underlying
tokenization capabilities to securely connect to first-party and third-party
Expand All @@ -182,7 +182,7 @@ Replace the following values in the sample file:
python3 invoke_connection_sample.py
```

### [Service account token generation](./sa_token_sample.py)
### [Service account token generation](sa_token_sample.py)

Generates SA Token using path of credentials file.

Expand All @@ -196,7 +196,7 @@ Replace `<YOUR_CREDENTIALS_FILE_PATH>` with the relative path to your service ac
python3 sa_token_sample.py
```

### [Generate Bearer Token](./generate_bearer_token_from_creds_sample.py)
### [Generate Bearer Token](generate_bearer_token_from_creds_sample.py)

Generates SA Token using json content of credentials file.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added v2/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions v2/samples/_insert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from v2.skyflow import Skyflow
from v2.skyflow.data import InsertRequest
1 change: 1 addition & 0 deletions v2/skyflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .client import Skyflow
1 change: 1 addition & 0 deletions v2/skyflow/client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._skyflow import Skyflow
60 changes: 60 additions & 0 deletions v2/skyflow/client/_skyflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from typing import List, Optional
from v2.skyflow.management.config import ManagementConfig
from v2.skyflow.utils import LogLevel
from v2.skyflow.vault.config import VaultConfig, CredentialsConfig, ConnectionConfig


class Skyflow:
def __init__(self,
vault_config: List[VaultConfig],
skyflow_credentials: Optional[CredentialsConfig],
connection_config: Optional[List[ConnectionConfig]] = None,
log_level: Optional[LogLevel] = None):
self.vault_config = vault_config
self.skyflow_credentials = skyflow_credentials
self.connection_config = connection_config
self.log_level = log_level

@classmethod
def builder(cls):
return cls._Builder()

class _Builder:
def __init__(self):
self._vault_config = []
self._connection_config = []
self._skyflow_credentials = None
self._log_level = None

def add_vault_config(self, vault_config: VaultConfig):
pass

def remove_vault_config(self, vault_id: str):
pass

def update_vault_config(self, vault_config: VaultConfig):
pass

def add_connection_config(self, connection_config: ConnectionConfig):
pass

def remove_connection_config(self, connection_id: str):
pass

def update_connection_config(self, connection_config: ConnectionConfig):
pass

def update_log_level(self, log_level: LogLevel):
pass

def log_level(self, log_level: str):
pass

def build(self):
pass

def vault(self, vault_id: str):
pass

def connection(self, connection_id: str):
pass
3 changes: 3 additions & 0 deletions v2/skyflow/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from v2.skyflow.vault import (
InsertRequest,
)
1 change: 1 addition & 0 deletions v2/skyflow/error/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from _skyflow_error import SkyflowError
6 changes: 6 additions & 0 deletions v2/skyflow/error/_skyflow_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Skyflow Error Class
class SkyflowError:
#class members
#constructor
def __init__(self):
pass
2 changes: 2 additions & 0 deletions v2/skyflow/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from _log_level import LogLevel
from _validations import Validations
8 changes: 8 additions & 0 deletions v2/skyflow/utils/_log_level.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import Enum

class LogLevel(Enum):
WARN = 'WARN'
INFO = 'INFO'
DEBUG = 'DEBUG'
ERROR = 'ERROR'
OFF = 'OFF'
4 changes: 4 additions & 0 deletions v2/skyflow/utils/_validations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#add necessary validations for requests and config
class Validations:
def __init__(self):
pass
3 changes: 3 additions & 0 deletions v2/skyflow/vault/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .model import (
InsertRequest,
)
3 changes: 3 additions & 0 deletions v2/skyflow/vault/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from _vault import VaultConfig
from _connection import ConnectionConfig
from _credentials import CredentialsConfig
5 changes: 5 additions & 0 deletions v2/skyflow/vault/config/_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ConnectionConfig:
#members
def __init__(self):
pass
#methods
6 changes: 6 additions & 0 deletions v2/skyflow/vault/config/_credentials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class CredentialsConfig:
#members
def __init__(self):
pass

#methods
5 changes: 5 additions & 0 deletions v2/skyflow/vault/config/_vault.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class VaultConfig:
#members
def __init__(self):
pass
#methods
4 changes: 4 additions & 0 deletions v2/skyflow/vault/controller/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from _audit import Audit
from _bin_look_up import BinLookUp
from _connections import Connection
from _detect import Detect
6 changes: 6 additions & 0 deletions v2/skyflow/vault/controller/_audit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Audit:
#members
def __init__(self):
pass
#methods

5 changes: 5 additions & 0 deletions v2/skyflow/vault/controller/_bin_look_up.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class BinLookUp:
#members
def __init__(self):
pass
#methods
5 changes: 5 additions & 0 deletions v2/skyflow/vault/controller/_connections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Connection:
#members
def __init__(self):
pass
#methods
5 changes: 5 additions & 0 deletions v2/skyflow/vault/controller/_detect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Detect:
#members
def __init__(self):
pass
#methods
5 changes: 5 additions & 0 deletions v2/skyflow/vault/controller/_vault.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Vault:
#members
def __init__(self):
pass
#methods
8 changes: 8 additions & 0 deletions v2/skyflow/vault/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# from v2.skyflow.vault.model.data.request import (
# InsertRequest,
# DetokenizeRequest
# )

from v2.skyflow.vault.model.data import (
InsertRequest
)
Empty file.
6 changes: 6 additions & 0 deletions v2/skyflow/vault/model/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .request import (
InsertRequest
)
from .response import (
InsertResponse
)
Empty file.
3 changes: 3 additions & 0 deletions v2/skyflow/vault/model/data/options/_insert_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class InsertOptions:
def __init__(self):
pass
2 changes: 2 additions & 0 deletions v2/skyflow/vault/model/data/request/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from ._detokenize import DetokenizeRequest
from ._insert import InsertRequest
10 changes: 10 additions & 0 deletions v2/skyflow/vault/model/data/request/_insert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class InsertRequest:
_table_name = None
#members
def __init__(self):
pass
#methods

def __set_table_name(self, table_name: str):
self.__table_name = table_name
print("st table name: ", self.__table_name)
2 changes: 2 additions & 0 deletions v2/skyflow/vault/model/data/response/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from _insert import InsertResponse
from _detokenize import DetokenizeResponse
5 changes: 5 additions & 0 deletions v2/skyflow/vault/model/data/response/_insert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class InsertResponse:
#members
def __init__(self):
pass
#methods
Empty file.
Empty file.

0 comments on commit 000ddcd

Please sign in to comment.