Skip to content

Commit 33d9687

Browse files
authored
Merge pull request #15 from forcedotcom/onboarding-readme-updates
Start on README updates, more to come
2 parents dd56855 + 7af4e1a commit 33d9687

File tree

2 files changed

+64
-8
lines changed

2 files changed

+64
-8
lines changed

README.md

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ More specifically, this codebase gives you ability to test code locally before p
88

99
Use of this project with Salesforce is subject to the [TERMS OF USE](./TERMS_OF_USE.md)
1010

11+
## Prerequisites
12+
13+
- Python 3.11 (If your system version is different, we recommend using [pyenv](https://github.com/pyenv/pyenv) to configure 3.11)
14+
- [Azul Zulu OpenJDK 17.x](https://www.azul.com/downloads/?version=java-17-lts&package=jdk#zulu)
15+
- Docker support like [Docker Desktop](https://docs.docker.com/desktop/)
16+
- A salesforce org, with some DLOs or DMOs with data
17+
- A [connected app](#creating-a-connected-app)
18+
1119
## Installation
1220
The SDK can be downloaded directly from PyPI with `pip`:
1321
```
@@ -19,12 +27,16 @@ You can verify it was properly installed via CLI:
1927
datacustomcode version
2028
```
2129

22-
## Development Setup
23-
We offer two built-in development interfaces: `devcontainers` and Jupyter, but you can set up any tool you would like manually.
30+
## Quick start
31+
Ensure you have all the [prerequisites](#prerequisites) prepared on your machine.
2432

25-
To get started, use the CLI to initialize a new development environment:
26-
```
27-
datacustomcode init [DIRECTORY TO DUMP NEW REPO]
33+
To get started, create a directory and initialize a new project with the CLI:
34+
```zsh
35+
mkdir datacloud && cd datacloud
36+
python3.11 -m venv .venv
37+
source .venv/bin/activate
38+
pip install salesforce-data-customcode
39+
datacustomcode init my_package
2840
```
2941

3042
This will yield all necessary files to get started:
@@ -43,11 +55,31 @@ This will yield all necessary files to get started:
4355
* `Dockerfile` <span style="color:grey;font-style:italic;">(Do not update)</span> – Development container emulating the remote execution environment.
4456
* `requirements-dev.txt` <span style="color:grey;font-style:italic;">(Do not update)</span> – These are the dependencies for the development environment.
4557
* `jupyterlab.sh` <span style="color:grey;font-style:italic;">(Do not update)</span> – Helper script for setting up Jupyter.
46-
* `requirements.txt` – Here you define the requirements that you will need remotely
58+
* `requirements.txt` – Here you define the requirements that you will need for your script.
4759
* `payload` – This folder will be compressed and deployed to the remote execution environment.
4860
* `config.json` – This config defines permissions on the back and can be generated programmatically with `scan` CLI method.
4961
* `entrypoint.py` – The script that defines the data transformation logic.
5062

63+
A functional entrypoint.py is provided so you can run once you've configured your connected app:
64+
```zsh
65+
cd my_package
66+
datacustomcode configure
67+
datacustomcode run ./payload/entrypoint.py
68+
```
69+
70+
> [!IMPORTANT]
71+
> The example entrypoint.py requires a `Account_Home__dll` DLO to be present. And in order to deploy the script (next step), the output DLO (which is `Account_Home_copy__dll` in the example entrypoint.py) also needs to exist and be in the same dataspace as `Account_Home__dll`.
72+
73+
After modifying the `entrypoint.py` as needed, using any dependencies you add in the `.venv` virtual environment, you can run this script in Data Cloud:
74+
```zsh
75+
datacustomcode scan ./payload/entrypoint.py
76+
datacustomcode deploy --path ./payload --name my_custom_script
77+
```
78+
79+
> [!TIP]
80+
> The `deploy` process can take several minutes. If you'd like more feedback on the underlying process, you can add `--debug` to the command like `datacustomcode --debug deploy --path ./payload --name my_custom_script`
81+
82+
5183
## API
5284

5385
You entry point script will define logic using the `Client` object which wraps data access layers.
@@ -98,6 +130,12 @@ Options:
98130
- `--client-secret TEXT`: Connected App Client Secret
99131
- `--login-url TEXT`: Salesforce login URL
100132

133+
#### `datacustomcode zip`
134+
Zip a transformation job in preparation to upload to Data Cloud.
135+
136+
Options:
137+
- `--path TEXT`: Path to the code directory (default: ".")
138+
101139
#### `datacustomcode deploy`
102140
Deploy a transformation job to Data Cloud.
103141

@@ -133,3 +171,21 @@ Argument:
133171
Options:
134172
- `--config-file TEXT`: Path to configuration file
135173
- `--dependencies TEXT`: Additional dependencies (can be specified multiple times)
174+
175+
## Prerequisite details
176+
177+
### Creating a connected app
178+
179+
1. Log in to salesforce as an admin. In the top right corner, click on the gear icon and go to `Setup`
180+
2. In the left hand side, search for "App Manager" and select the `App Manager` underneath `Apps`
181+
3. Click on `New Connected App` in the upper right
182+
4. Fill in the required fields within the `Basic Information` section
183+
5. Under the `API (Enable OAuth Settings)` section:
184+
1. Click on the checkbox to Enable OAuth Settings.
185+
2. Provide a callback URL like http://localhost:55555/callback
186+
3. In the Selected OAuth Scopes, make sure that `refresh_token`, `api`, `cdp_query_api`, `cdp_profile_api` is selected.
187+
4. Click on Save to save the connected app
188+
6. From the detail page that opens up afterwards, click the "Manage Consumer Details" button to find your client id and client secret
189+
7. Go back to `Setup`, then `OAuth and OpenID Connect Settings`, and enable the "Allow OAuth Username-Password Flows" option
190+
191+
You now have all fields necessary for the `datacustomcode configure` command.

src/datacustomcode/templates/jupyterlab.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ check_docker() {
4848
# Function to start Jupyter server
4949
start_jupyter() {
5050
echo "Building the docker image"
51-
docker build -t datacloud-byoc .
51+
docker build -t datacloud-customcode .
5252

5353
echo "Running the docker container"
5454
docker run -d --rm -p 8888:8888 \
5555
-v $(pwd):/workspace \
5656
--name jupyter-server \
57-
datacloud-byoc jupyter lab \
57+
datacloud-customcode jupyter lab \
5858
--ip=0.0.0.0 \
5959
--port=8888 \
6060
--no-browser \

0 commit comments

Comments
 (0)