SnapLogic Technical Blog

Technical insights from SnapLogic's subject matter experts

Top Content

I spent more than two decades working for SAP. When Matthew Bowen approached me about helping him understand our SAP Snaps better, we started digging into them immediately. After a while, we both felt it would be a great idea to not only share the knowledge inside Snaplogic but also start a blog series on integrating with SAP and help shed some light not only on the Snaps themselves but also on the SAP side. This article will kick everything off by looking at our SAP IDoc Snaps. The series will start with a general overview of the Snaps and the required prerequisites. We then look at creating IDocs from a Snaplogic pipeline and taking a peek at the processing inside SAP before continuing to show you how to send a status change back to SAP for a given IDoc you received in a pipeline. Finally, we close the series by looking at securing the communication between the SnapLogic GroundPlex and SAP with Secure Network Communication (SNC).
2 years ago
Introduction SnapLogic is a cloud-based integration Platform-as-a-Service (iPaaS) that provides tools for connecting various applications, data sources, and APIs. It enables businesses to automate and streamline their data integration processes by offering pre-built connectors and a visual interface for designing integration workflows. The SnapLogic platform uses a SnapLogic pipeline, a series of connected "Snaps" (pre-built components) that define the flow and transformation of data between various systems and applications. In a SnapLogic pipeline, data flows from one Snap to another, with each Snap performing a specific function, such as data extraction, transformation, or loading (ETL). SnapLogic Designer The SnapLogic Designer is the user interface that enables you to develop pipelines. You can see the example page below. But in SnapLogic with a feature called “Asset Palette,” you may see the different styles of Side Panel view. But the features are the same as those of the side panel view.   The designer page consists of three main parts: Canvas - The field for visualizing and editing the pipeline   Side Panel / Asset Palette - The panel contains the menu list. (The left picture is the Side Panel view. The right picture is Asset Palette enabled) Snaps Catalog - lists all available Snaps. https://docs-snaplogic.atlassian.net/wiki/x/ePIV Pipelines Catalog - list all pipelines that you can access. https://docs-snaplogic.atlassian.net/wiki/x/w-IV Patterns Catalog - list all the patterns that you can access. https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/3022160260/Patterns+Catalog   Toolbar - The list of tools for the pipeline   Icons Description Execute Pipeline   Execute the pipeline. Validate Pipeline   Validate the pipeline. Any unsaved changes will be saved before validation. Clicking the button while a validation is in process cancels that validation. Shift-clicking the button will clear the cache before validating. Edit Pipeline Properties   You specify properties when creating a pipeline. Click this button to modify the properties. Check Pipeline Statistics   As a pipeline executes, the statistics are updated periodically so that you can monitor its progress. Create Task   Create a Task for the current pipeline. Save Pipeline   Save the current pipeline. Export Pipeline   Export the current pipeline. Copy Pipeline   Copy the pipeline from one project to another. Move Pipeline   Move the pipeline from one project to another. Delete Pipeline   Delete the current pipeline Pipeline Versions   Create versions of the pipeline. Compare Pipeline   Compare the current pipeline with the target pipeline. Notes   Add a note or delete an existing note. Notes are saved with the pipeline. Print   Print the pipeline. Snaps Snaps are the building blocks of a pipeline. Each Snap performs a single function, such as reading, parsing, transforming, or writing data. You can view the Snaps available to you (or your account) in the Snaps Catalog on the left-hand side of the SnapLogic Designer. You can drag a Snap from the Snap Catalog onto the Canvas to use it in a pipeline. Snaps Type SnapLogic includes the following basic types of Snaps with distinct icons. Icon Snap Type Description   Read Specifies data sources in the pipeline. Examples: File Reader, CSV Generator, Birst Query   Parse Takes the input of unstructured data and generates an output of structured data. Examples: XML Parser, Sequence Parser, JSON Parser   Transform Modifies data significantly. Examples: Mapper, Aggregate, Join   Flow Changes the output or direction of data in a pipeline. Examples: Router, Gate, Union   Format Changes the data format. Examples: CSV Formatter, JSON Formatter, Excel Formatter   Write Specifies data destinations in a pipeline. Examples: File Writer, REST Post, Email Delete Connecting Snaps The key to creating a Pipeline in SnapLogic is connecting Snaps. There are a few things to consider when placing Snaps in a Pipeline. Connection Shapes Like puzzle pieces, only Snaps with matching connection pairs (circles or diamonds) can be connected between the input and output of two snaps. When you drag a snap and place it next to or in front of another snap, the snap will automatically connect both snaps, and the connection will change color, which means it connects successfully. If the color doesn’t change, you need to recheck that both connection shapes are the same and re-connect it again. Disconnect Linked Snaps Unlinked Snaps can be moved apart or placed next to each other. Make sure the circle or diamond connector is colored Blue, which indicates that the Snaps are linked.     To disconnect linked Snaps, click on the Blue connector. This clears the color and allows you to rearrange the Snaps. Remote-Connect Link Snaps You can connect to Snaps, but not next to each other, using a remote-connect link. For example, click and hold on the Mapper Snap connector until it turns Yellow, then drag it to the Copy Snap connector. When both connections turn Blue, release the mouse button. A number is placed in both connectors to let you know they are connected. Note: The number is only temporary until the Pipeline is saved. At this point, a new, permanent number may be assigned. You can also click and hold on one connection, and both Snaps connected by this link will darken. This feature is helpful for large pipelines where it may take much work to visualize the connections quickly. Data model SnapLogic will pass the data between Snaps with two models: Document data The document data models will be represented by a circle shape. This data type uses the JSON format as a container of the data. The support data type in this model is similar to the JSON standard in that it includes string, boolean, number, array, object, and null. Binary data The document data models will be represented by a diamond shape. This data type will wrap the binary data in SnapLogic’s model. Mostly, this will be inputted to the file writer and parser and outputted from the file reader and formatter. Configuration Snaps You have two options to open the configuration dialog. First, left-click on the Snap that you want to configure. The dialog will show up immediately.  The second way is right-clicking at the Snap, and the menu displays options available in all Snaps through a dropdown list will be shown. Then click “Edit” in the menu. Each Snap will have different configurations. You can learn more about the configuration of each snap by clicking the question mark icon on the top right of the dialog. Expression The SnapLogic expression language is a utility that is available to Snaps. You can use expressions (JavaScript syntax) to access functions and properties to set field values dynamically. You can also use the expression language to manipulate data.  Example   $text == "NFL" ? "foo" : "bar" $counter > 1 ? ($counter < 3 ? 50 : 100) : -1   Expressions are available across multiple Snaps. If the Snap exposes the functionality of the expression for a property, then the  icon appears in front of the property's text box. You can toggle on or off by clicking on the icon. When the toggle is on, the down arrow within the field will appear. You can click to see the list of functions and properties available.   Operations List of supported and unsupported operations available on (document https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438042/Understand+Expressions+in+the+SnapLogic+Platform) Accessing Pipeline Parameters Parameters allow a pipeline to be reused in multiple situations. For example, a File Writer Snap can be configured to write to a file path specified by a parameter, which allows the same pipeline to write to different files. The parameters for a pipeline can be defined by using the Edit Pipeline properties dialog. The name of each parameter must only contain alpha-numeric characters, and the value will be converted to a string. The value for a parameter defined in the pipeline properties dialog is treated as the default when running the pipeline in Designer. Parameters can also be passed to the Pipeline Execute Snap. Any parameters not passed down from the Task or Snap will use the defaults specified in the properties dialog. To access a pipeline parameter from the expression language, you must prefix the parameter name with an underscore. For example, given the following parameters: Key Value firstName  Bob numValue 12 path $.age The "firstName" parameter can then be accessed using _firstName, as in:   "Hello, " + _firstName // result: Hello, Bob   Since the value of a parameter is always a string, you'll need to convert any string to numeric values before operating on them. For example, simply adding two to the "numValue" parameter will append the character "2" to "12" and yield "122":   _numValue + 2 // result: "122"   Instead, you need to use the parseInt/parseFloat functions to parse the string into a value and then add two to it:   parseInt(_numValue) + 2 // result: 14   You need to parameterize your pipeline with an expression. You can use the eval() function to evaluate an expression stored in a string.  For example, to read the document field specified by the "path" parameter, you can use:   eval(_path) // result: <the value of the "age" field in the current document>   Accessing Input View Variables as Part of Expressions An input view schema attribute can be used as part of the expression using the dollar sign ($) prefix. Example The REST Put Snap provides a URL. The URL can be toggled into an expression, and the expressions could be created by dynamically substituting the variables from an input view, such as:   'http://someplace:someport/somepart/' + $inputvar + '/somemoreparts'   Accessing secret value from the secrets manager Any expression-enabled authentication field in a Snap or Account can be used with Secrets Management. You can enter an expression that retrieves a secret stored in your secrets manager, such as an access token, a username, or a password. To use the values from the secrets manager, you must first create secrets myaccesskey and mysecretkey in the Secrets Manager vault. Then, create or modify the Account and enter an expression in the required fields. Learn more: Configure Accounts to use secrets. Account An account represents an object that encompasses details to connect to an endpoint. Accounts play a crucial role in integrating applications. Any Snap that communicates with an external endpoint needs an authenticated account to access the resources on the endpoint. For example, a MySQL Snap requires authenticated access to a MySQL database. In SnapLogic, you create an Account to store credentials and any other information necessary to connect, such as a URL, hostname, and port number. You can create an account from Designer or Manager. In Designer, when working on pipelines, every Snap needing an account prompts you to create a new account or use an existing one. To use an existing account, you can click the dropdown icon to show all the available accounts for the snaps. To create a new account, click the “Add Account” button below the property field and follow the steps. The account will be created in your selected location on the first step. You can manage the created account on the Manager page in that location. Note: You can learn more about account type and each property by clicking the icon question mark in the top right corner. Validation & Execute Pipeline Sometimes, we want to test the pipeline by dry-running it without running the write snaps. You can use the validate function  on the toolbar menu. The difference between validate and execute is before each snap runs. It will check the property called “Snap execution.” There are three opinions on how to trigger the snaps.   Validate & Execute - this option makes the snaps run on both the validation and execution steps. Execute only - this option makes the snaps run on only the execution step. The snap writer type uses this as a default value. Disabled - this option prevents the snaps from running. Note: By default, the validation will be triggered every time we change the configuration of the snaps in the pipeline. Preview Data After executing or validating the pipeline, they will have a preview icon in the connection joint. The preview dialog will appear when you click on it, showing the snaps' output data. For example, when we click the preview icon, the pipeline above will show output data from JSON Generator snaps. The preview dialog has three types: JSON, Table, and Raw. You can select the dropdown on Preview Type and choose the type you like. JSON Table Raw Create First Pipeline This section will show how you start creating the pipeline, from the requirement to checking the result and running the final pipeline. For the example scenario, we want to calculate the employees list to check who needs to be assigned marketing training. The list of our employees looks like the data below.   [ { "Name": "Albert Maro", "Location": "Field", "Extension": 4357, "Email": "amaro@company.com", "Title": "Director, Eastern US", "Department": "Sales", "Dept ID": 1100 }, { "Name": "Anthony Dunn", "Location": "HQ", "Extension": 4387, "Email": "adunn@company.com", "Title": "Social Media Director", "Department": "Marketing", "Dept ID": 1200 }, { "Name": "Rich Harris", "Location": "CO", "Extension": 4368, "Email": "rharris@company.com", "Title": "Principal Developer", "Department": "Engineering", "Dept ID": 1300 } // more data ]   The constraint of needing training is an employee in the marketing department working at “HQ.” We want the list of employees with Firstname, Lastname, Email, Title, and Training fields. The result should look like below.   [ { "Firstname": "Albert", "Lastname": "Maro", "Email": "amaro@company.com", "Title": "Director, Eastern US", "Training": false }, { "Firstname": "Anthony", "Lastname": "Dunn", "Email": "adunn@company.com", "Title": "Social Media Director", "Training": true }, { "Firstname": "Rich", "Lastname": "Harris", "Email": "rharris@company.com", "Title": "Principal Developer", "Training": false } // more data ]   Steps 1. Open the Designer page. 2. Click  to create a new pipeline.   3. Change the label to “Employees training” and click save. 4. At this step, we already have a new empty pipeline. Then, find the “JSON Generator” snap from the side panel and drag it to the canvas screen. This snap generates a JSON document for the next snap in the pipeline. We will set it as an input source. 5. Click at the JSON Generator snap to open the configuration dialog and click “Edit JSON.” Then, replace all JSON with the value below.   [ { "Name": "Albert Maro", "Location": "Field", "Extension": 4357, "Email": "amaro@company.com", "Title": "Director, Eastern US", "Department": "Sales", "Dept ID": 1100 }, { "Name": "Anthony Dunn", "Location": "HQ", "Extension": 4387, "Email": "adunn@company.com", "Title": "Social Media Director", "Department": "Marketing", "Dept ID": 1200 }, { "Name": "Rich Harris", "Location": "CO", "Extension": 4368, "Email": "rharris@company.com", "Title": "Principal Developer", "Department": "Engineering", "Dept ID": 1300 } // more data ]   Click “Ok” and save button ( ) before close the dialog. 6. Wait for the validation to finish. If it doesn’t run validation, click the validation button to manually validate the pipeline. 7. Find the “Mapper” snap and drag it to after the JSON generator. The Mapper snap transforms incoming data with the specific mappings and produces new output data. 8. Click on the Mapper snap to open the configuration dialog. We focus on the five blocks at the bottom of the dialog. Input Schema - shows the schema of input data Mapping table - is the configuration to map from input data to new output data Target Schema -shows the schema of output data. But this snap hasn’t been validated yet, so it shows nothing. Input Preview - shows the current input data Output Preview - shows the current output data Next, set the mapping table with the information below.  To add multiple mapping, click  in the top right corner. Expression Target path $Name.split(' ')[0] $Firstname $Name.split(' ')[1] $Lastname $Email $Email $Title $Title $Location == "HQ" && $Department == "Marketing" $Trainging The finish configuration will look like this. Click save and close the dialog. 9. Click the preview button after the Mapper snap. The output should be like this. SnapGPT SnapGPT is an interactive tool inside SnapLogic Designer. It uses the power of LLMs to democratize integration by helping users create and manage integrations using natural language prompts. The SnapGPT can do six main functions in SnapLogic. Generate pipelines Describe pipelines Analyze pipelines Ask anything about the SnapLogic Intelligent Integration Platform (IIP) Generate SnapLogic expressions Create SQL queries Usage SnapGPT You can open the SnapGPT panel by clicking on the SnapGPT logo in the header bar. Then, the panel will be displayed with a welcome message. Next, we will show how to use each feature of SnapGPT on the SnapLogic platform. Generate pipelines Prompt direct to the SnapGPT Example prompts: Extract opportunity object records from Salesforce and add them to Snowflake Create a Pipeline using Salesforce Read to fetch my Opportunities, Filter out any opportunities outside of the last fiscal quarter, then write them to Snowflake. Extract opportunity object records from Salesforce closed before “2022-10-01” and add them to Snowflake. Create a pipeline that fetches my SnapLogic Activity Logs from the SnapLogic API. Describe pipelines Open the pipeline you want to describe, then go to the SnapGPT panel and ask, “Describe the pipeline.” Example prompts: Describe the pipeline Analyze pipelines Open the pipeline you want to analyze, then go to the SnapGPT panel and ask, “Analyze the pipeline.” Example prompts: Analyze the pipeline Result: SnapGPT identifies issues with the pipeline and makes suggestions for improvement, and Snaps in the pipeline offers suggestions. Ask anything about the SnapLogic Intelligent Integration Platform (IIP) Example prompts: How do I build a pipeline? When and how should I use the Salesforce SOQL snap? How can one pipeline call another pipeline? Can pipelines use recursion? How is an Ultra pipeline different from a regular pipeline?   Generate SnapLogic expressions To begin, simply open a snap and select the  icon. This action activates the expression generation feature, enabling me to assist you in creating expressions. I can start creating expressions for you either in our chat or inside the expression-enabled field itself by typing the prompt and then clicking on the SnapGPT icon  . Example prompts: Generate an expression to filter my closed lost opportunities. Generate an expression to grab the current date and time. Create SQL queries Open a Snap that supports SQL or SOQL queries and open SnapGPT. For example, if you open the Salesforce SOQL Snap, the suggestion Create SQL query appears above the SnapGPT prompt. SnapGPT generates the query and displays it in the SQL Preview panel. You can review the generated SQL before applying to the snap. Example prompt: Generate a SQL query to get the total amount of opportunities closed within the last quarter grouped by the account's country and deal status.  
9 months ago
Organizations typically have DevOps procedures and tooling for automation around their legacy microservices or services. SnapLogic has a robust Public API available for those teams to automate publication, versioning, deprecation, migration, and even retirement of both APIs hosted in SnapLogic APIM, and API proxies managed in SnapLogic. We've created a Postman Collection and set of environments that those DevOps teams might leverage to help them manage their APIs in SnapLogic even faster.
2 years ago
What are embeddings Embeddings are numerical representations of real-world objects, like text, images or audio. They are generated by machine learning models as vectors, an array of numbers, where the distance between vectors can be seens as the degree of similarity between objects. While an embedding model may have its own meaning for each of the dimensions, there’s no guarantee between embedding models of the meaning for each of the dimensions used by the embedding models. For example, the word “cat”, “dog” and “apple” might be embedded into the following vectors: cat -> (1, -1, 2) dog -> (1.5, -1.5, 1.8) apple -> (-1, 2, 0) These vectors are made-up for a simpler example. Real vectors are much larger, see the Dimension section for details. Visualizing these vectors as points in a 3D space, we can see that "cat" and "dog" are closer, while "apple" is positioned further away. Figure 1. Vectors as points in a 3D space By embedding words and contexts into vectors, we enable systems to assess how related two embedded items are to each other via vector comparison. Dimension of embeddings The dimension of embeddings refers to the length of the vector representing the object. In the previous example, we embedded each word into a 3-dimensional vector. However, a 3-dimensional embedding inevitably leads to a massive loss of information. In reality, word embeddings typically require hundreds or thousands of dimensions to capture the nuances of language. For example,  OpenAI's text-embedding-ada-002 model outputs a 1536-dimensional vector Google Gemini's text-embedding-004 model outputs a 768-dimensional vector Amazon Titan's amazon.titan-embed-text-v2:0 model outputs a default 1024-dimensional vector Figure 2. Using text-embedding-ada-002 to embed the sentence “I have a calico cat.” In short, an embedding is a vector that represents a real-world object. The distance between these vectors indicates the similarity between the objects. Limitation of embedding models Embedding models are subject to a crucial limitation: the token limit, where a token can be a word, punctuation mark, or subword part. This constraint defines the maximum amount of text a model can process in a single input. For instance, the Amazon Titan Text Embeddings models can handle up to 8,192 tokens. When input text exceeds the limit, the model typically truncates it, discarding the remaining information. This can lead to a loss of context and diminished embedding quality, as crucial details might be omitted. To address this, several strategies can help mitigate its impact:  Text Summarization or Chunking: Long texts can be summarized or divided into smaller, manageable chunks before embedding.  Model Selection: Different embedding models have varying token limits. Choosing a model with a higher limit can accommodate longer inputs. What is a Vector Database Vector databases are optimized for storing embeddings, enabling fast retrieval and similarity search. By calculating the similarity between the query vector and the other vectors in the database, the system returns the vectors with the highest similarity, indicating the most relevant content.  The following diagram illustrates a vector database search. A query vector 'favorite sport' is compared to a set of stored vectors, each representing a text phrase. The nearest neighbor, 'I like football', is returned as the top result. Figure 3. Vector Query Example Figure 4. Store Vectors into Database Figure 5. Retrieve Vectors from Database When working with vector databases, two key parameters come into play: Top K and similarity measure (or distance function). Top K When querying a vector database, the goal is often to retrieve the most similar items to a given query vector. This is where the Top K concept comes into play. Top K refers to retrieving the top K most similar items based on a similarity metric. For instance, if you're building a product recommendation system, you might want to find the top 10 products similar to the one a user is currently viewing. In this case, K would be 10. The vector database would return the 10 product vectors closest to the query product's vector. Similarity Measures To determine the similarity between vectors, various distance metrics are employed, including: Cosine Similarity: This measures the cosine of the angle between two vectors. It is often used for text-based applications as it captures semantic similarity well. A value closer to 1 indicates higher similarity. Euclidean Distance: This calculates the straight-line distance between two points in Euclidean space. It is sensitive to magnitude differences between vectors. Manhattan Distance: Also known as L1 distance, it calculates the sum of the absolute differences between corresponding elements of two vectors. It is less sensitive to outliers compared to Euclidean distance. Figure 6. Similarity Measures There are many other similarity measures not listed here. The choice of distance metric depends on the specific application and the nature of the data. It is recommended to experiment with various similarity metrics to see which one produces better results. What embedders are supported in SnapLogic As of October 2024, SnapLogic has supported embedders for major models and continues to expand its support. Supported embedders include: Amazon Titan Embedder OpenAI Embedder Azure OpenAi Embedder Google Gemini Embedder What vector databases are supported in SnapLogic Pinecone OpenSearch MongoDB Snowflake Postgres AlloyDB Pipeline examples Embed a text file Read the file using the File Reader snap. Convert the binary input to a document format using the Binary to Document snap, as all embedders require document input. Embed the document using your chosen embedder snap. Figure 7. Embed a File Figure 8. Output of the Embedder Snap Store a Vector Utilize the JSON Generator snap to simulate a document as input, containing the original text to be stored in the vector database. Vectorize the original text using the embedder snap. Employ a mapper snap to format the structure into the format required by Pinecone - the vector field is named "values", and the original text and other relevant data are placed in the "metadata" field. Store the data in the vector database using the vector database's upsert/insert snap. Figure 9. Store a Vector into Database Figure 10. A Vector in the Pinecone Database Retrieve Vectors  Utilize the JSON Generator snap to simulate the text to be queried. Vectorize the original text using the embedder snap. Employ a mapper snap to format the structure into the format required by Pinecone, naming the query vector as "vector". Retrieve the top 1 vector, which is the nearest neighbor. Figure 11. Retrieve Vectors from a Database   [ { "content" : "favorite sport" } ]   Figure 12. Query Text  Figure 13. All Vectors in the Database   { "matches": [ { "id": "db873b4d-81d9-421c-9718-5a2c2bd9e720", "score": 0.547461033, "values": [], "metadata": { "content": "I like football." } } ] }   Figure 14. Pipeline Output: the Closest Neighbor to the Query  Embedder and vector databases are widely used in applications such as Retrieval Augmented Generation (RAG) and building chat assistants.  Multimodal Embeddings While the focus thus far has been on text embeddings, the concept extends beyond words and sentences. Multimodal embeddings represent a powerful advancement, enabling the representation of various data types, such as images, audio, and video, within a unified vector space. By projecting different modalities into a shared semantic space, complex relationships and interactions between these data types can be explored. For instance, an image of a cat and the word "cat" might be positioned closely together in a multimodal embedding space, reflecting their semantic similarity. This capability opens up a vast array of possibilities, including image search with text queries, video content understanding, and advanced recommendation systems that consider multiple data modalities.
9 months ago

Recent Blogs

About SnapLogic Technical Blog

Node avatar for SnapLogic Technical Blog
Technical insights from SnapLogic's subject matter experts
35 PostsCreated: 2 years agoLatest Activity: 10 days ago
21 Following