Execute cells with SOQL and APEX within Jupyter notebooks
Project description
jupyter-sfdxmagic
Description
This is a set of cell magics to run anonymous APEX code in notebooks and perform SOQL queries returning the records in a pandas DataFrame.
Prerequisite
The connection to Salesforce are performed through sfdx, the magic assume sfdx is correctly installed and at least the default organization has been authorized.
The module assumes to be in the same environment where jupyterlab is installed
Installation
Through pip
$ pyhthon -m pip install sfdxmagic
Usage
To load the extension:
%load_ext sfdxmagic
%%sfdx:apex
Runs anonymous APEX:
%%sfdx:apex
System.debug('hello world!');
Append the name of a variable to return the log lines as a list
%%sfdx:apex logs
...
%%sfdx:query
Perform a SOQL query:
%%sfdx:query
SELECT Id, Name FROM Lead LIMIT 10
Append the name of a variable to return the records as a pandas DataFrame
%%sfdx:query df_records
...
General invocation
Parameters passed to the commands are forwarded to the sfdx cli, this allows to retrieve results from multiple organizations in the same notebook.
%%sfdx:query df_records_org1 --targetusername username@domain.com.org1
...
%%sfdx:query df_records_org2 --targetusername username@domain.com.org2
...
Known issues
- Missing subquery handling, results are not unpacked and the projection is lost
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sfdxmagic-0.0.2.tar.gz.
File metadata
- Download URL: sfdxmagic-0.0.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f817b72ce8999997173e2c0fe261f55f3b93e9fda0b00db75a153e0b3dd2647f
|
|
| MD5 |
35ebbdf782b4624264509880ec055c82
|
|
| BLAKE2b-256 |
9db9dd9c91c607e5d32ff2b1759eb761ea19d41b1401bb74a0ea3a8b8fbc534c
|
File details
Details for the file sfdxmagic-0.0.2-py3-none-any.whl.
File metadata
- Download URL: sfdxmagic-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a7e2cb37b061940a7ca7215c5fe42eac2ef02730475955bf2652b41b7766ffe
|
|
| MD5 |
283c8e36e267d95ecfbb03204325fa3f
|
|
| BLAKE2b-256 |
1e3b4c9019fa88b0ad241eb6d0605463fba0253c7ed77741c2f47b16e34afef9
|