Skip to content

DOC-2826: support import pre build solution in graph studio; #73

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

Draft
wants to merge 2 commits into
base: 4.2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/graphstudio/images/import-options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 117 additions & 4 deletions modules/graphstudio/pages/export-and-import-solution.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,22 @@ Click btn:[Import an Existing Solution] to upload a previously exported tar file

image::import-solution.png[]

After uploading the file, you will see a dialog to customize the import options.

image::import-options.png[]

[NOTE]
====
Enable UDF is optional. If you do not enable UDF, some solutions may fail to install if their queries or loading jobs require UDFs.
If you check the `Enable UDF` option, UDF will be enabled automatically when importing the solution, and will be disabled after the import is complete.
====

[NOTE]
====
In order to optimize the time required for import, the imported queries will not be installed but saved as drafts. You need to install them manually.
Install queries is optional. If you do not check the `Install Queries` option, the imported queries will not be installed but saved as drafts.
You can install them manually later.
If you check the `Install Queries` option, the imported queries will be installed automatically.
If you have a large number of queries, this may take a long time.
====

[WARNING]
Expand All @@ -68,7 +81,107 @@ Please be extra cautious when importing databases as it can overwrite the curren
Importing a new solution cannot be undone to restore the previous state, regardless of whether the import succeeds or fails.

Therefore, create a complete backup beforehand in case you need to restore the database: xref:{page-component-version}@tigergraph-server:backup-and-restore:backup-cluster.adoc[]

For security purposes, TigerGraph has two `gadmin` commands, `GSQL.UDF.Policy.Enable` and `GSQL.UDF.Policy.HeaderAllowlist` to prevent malicious code execution during import.
Please refer to the section on xref:{page-component-version}@gsql-ref:querying:func/query-user-defined-functions.adoc#_udf_security[UDF Security] to ensure that UDFs comply with the security specifications. This will help you import the solution successfully.
====

=== Install Pre-Built Solution

==== Step 1: Download Solution

Download the pre-built solution package by clicking the download button.

image::download_prebuilt_solution.png[]

==== Step 2: Enable UDF (Optional)

If your tigergraph version is 4.2.1 or later, you can skip this step as we provide enable UDF option when import solution.

By default, TigerGraph does not enable solutions with User-Defined Functions (UDF). You will need to enable UDF manually if required.

*This step is required only for the following solutions:*

- Application Fraud
- Entity Resolution

Enable UDF by running the following commands in command line:

[source,sh]
----
gadmin config set GSQL.UDF.Policy.Enable false
gadmin config set GSQL.UDF.EnablePutExpr true
gadmin config set GSQL.UDF.EnablePutTokenBank true
gadmin config set GSQL.UDF.EnablePutTgExpr true
gadmin config apply -y
gadmin restart gsql -y
----

After importing the solution, you can disable UDF by running the following command:
[source,sh]
----
gadmin config set GSQL.UDF.Policy.Enable true
gadmin config set GSQL.UDF.EnablePutExpr false
gadmin config set GSQL.UDF.EnablePutTokenBank false
gadmin config set GSQL.UDF.EnablePutTgExpr false
gadmin config apply -y
gadmin restart gsql -y
----

==== Step 3: Import Solution

Follow the instructions in the <<Import>> section above to import the downloaded solution file.

==== Step 4: Setup Queries for Insights Application (Optional)

*This step is required for solutions with insights applications:*

- Transaction Fraud
- Mule Account Detection
- Application Fraud
- Network Infrastructure

{empty}

After importing the solution, you may need to configure queries for the insights application to enable proper visualization and functionality.

Step 4.1: Install Queries

If your tigergraph version is 4.2.1 or later, we already provider install queries when import solution, so you may skip this step.

By default, imported queries run in interpreted mode. For optimal performance, install the queries first.
For detailed instructions, see xref:write-queries.adoc#install-all-queries[Install All Queries].

Step 4.2: Preprocess Data

Some solutions require running specific queries to preprocess the data before the insights application can display results properly.

*This preprocessing step is required only for the following solutions:*

- Mule Account Detection
- Transaction Fraud

{empty}

Use the GSQL web shell or command line to run the corresponding preprocessing queries.

*Mule Account Detection*

[source,gsql]
----
use graph Mule_Account_Detection
run query account_account_with_weights()
run query tg_wcc_account_with_weights()
run query tg_pagerank_wt_account()
run query tg_shortest_path_length_account()
----

*Transaction Fraud*

[source,gsql]
----
use graph Transaction_Fraud
run query merchant_merchant_with_weights()
run query card_card_with_weights()
run query tg_wcc_card_weight_based()
run query tg_wcc_merchant_weight_based()
run query tg_pagerank_wt_merchant()
run query tg_pagerank_wt_card()
----