<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pavlo Paska</title>
    <description>The latest articles on DEV Community by Pavlo Paska (@pavlopaska).</description>
    <link>https://dev.to/pavlopaska</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F458532%2Fd5ba35b0-f760-4a06-90cb-1bbd526dde9b.jpg</url>
      <title>DEV Community: Pavlo Paska</title>
      <link>https://dev.to/pavlopaska</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pavlopaska"/>
    <language>en</language>
    <item>
      <title>How To Make Parallel API calls in JSPython</title>
      <dc:creator>Pavlo Paska</dc:creator>
      <pubDate>Thu, 13 Oct 2022 07:00:21 +0000</pubDate>
      <link>https://dev.to/pavlopaska/how-to-make-parallel-api-calls-in-jspython-59o1</link>
      <guid>https://dev.to/pavlopaska/how-to-make-parallel-api-calls-in-jspython-59o1</guid>
      <description>&lt;p&gt;It is quite a common scenario when you have to make multiple an API calls in parallel. Making parallel calls will reduce the latency and improve the performance of your solution. Either you are looking to speed up a data loading process or perform some sort of load/stress testing.&lt;br&gt;
In Javascript, you can spin up multiple &lt;code&gt;Promises&lt;/code&gt; and then use the function &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all" rel="noopener noreferrer"&gt;Promise.all()&lt;/a&gt; to wait for all of them to succeed. Or you can use RxJS, streams or controlled callbacks&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.jspython.dev/" rel="noopener noreferrer"&gt;JSPython &lt;/a&gt;was designed to evaluate all instructions synchronously. Mainly because of simplicity, it looks like Python users - data engineers and analysts don't like the complexity that comes with Promises, Streams or callbacks. JSPython awaits/resolves all promises at its core. So, you won't have any Promise anywhere in the JSPython runtime (apart from some edge cases).&lt;/p&gt;

&lt;p&gt;So, how to run code parallel, then?&lt;br&gt;
The answer is &lt;a href="https://rxjs.dev/guide/overview" rel="noopener noreferrer"&gt;RxJs&lt;/a&gt;. You can use RxJs functions to create observable sequences, then combine response values they emitted (with forkJoin) and convert them back to Promise (which will be automatically evaluated in JSPython)&lt;/p&gt;

&lt;p&gt;The following JSPython code shows this approach in action. This example makes five parallel requests and returns an array of responses along with the corresponding requestId&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;rxjs&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;forkJoin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lastValueFrom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;map&lt;/span&gt;

&lt;span class="n"&gt;ids&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;httpRequests&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ids&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;requestId&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;httpRequest&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GET&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://jsonplaceholder.typicode.com/posts/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                                            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                                                &lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
                                            &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;lastValueFrom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;forkJoin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;httpRequests&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go through the code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Import RxJs functions&lt;/li&gt;
&lt;li&gt;Create an array of ids.&lt;/li&gt;
&lt;li&gt;Use &lt;a href="https://www.w3schools.com/jsref/jsref_map.asp" rel="noopener noreferrer"&gt;map function&lt;/a&gt; to transform an array of ids into an array of Observables.&lt;/li&gt;
&lt;li&gt;Use the &lt;strong&gt;httpRequest$&lt;/strong&gt; function to fetch data from a server. The asynchronous built-in function sends an HTTP request, and returns an Observable that emits the requested data when the response is received.&lt;/li&gt;
&lt;li&gt;Then we use observable's &lt;a href="https://www.learnrxjs.io/learn-rxjs/operators/transformation/map" rel="noopener noreferrer"&gt;pipe(map(...))&lt;/a&gt; and transform result, by adding a requestId and response&lt;/li&gt;
&lt;li&gt;Then we wait for all observables to complete and combine responses in the array. We use &lt;a href="https://www.learnrxjs.io/learn-rxjs/operators/combination/forkjoin" rel="noopener noreferrer"&gt;forkJoin &lt;/a&gt; for this&lt;/li&gt;
&lt;li&gt;Then convert observable into Promise with function &lt;a href="https://rxjs.dev/api/index/function/lastValueFrom" rel="noopener noreferrer"&gt;lastValueFrom&lt;/a&gt;. Then, JSPython natively resolves Promise into a synchronous result &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Run
&lt;/h2&gt;

&lt;p&gt;Press &lt;code&gt;Run&lt;/code&gt; and you will see the result&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5zwo38rkgug3iocwouaq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5zwo38rkgug3iocwouaq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Working example
&lt;/h2&gt;

&lt;p&gt;A working example can be found here&lt;br&gt;
&lt;a href="https://run.worksheet.systems/data-studio/app/guest/jspy-playground?file=http-calls%2Fparallel-http-requests.jspy" rel="noopener noreferrer"&gt;https://run.worksheet.systems/data-studio/app/guest/jspy-playground?file=http-calls%2Fparallel-http-requests.jspy&lt;/a&gt;&lt;br&gt;
or if you are using chrome extention&lt;br&gt;
&lt;a href="//chrome-extension://dkhnlgcpdiifkfjdjceogenclkdfbonh/index.html#/data-studio/app/guest/jspy-playground?file=http-calls%2Fparallel-http-requests.jspy"&gt;chrome-extension://dkhnlgcpdiifkfjdjceogenclkdfbonh/index.html#/data-studio/app/guest/jspy-playground?file=http-calls%2Fparallel-http-requests.jspy&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Sequential vs. Parallel API Calls
&lt;/h2&gt;

&lt;p&gt;In another example, I want to show two different functions where one of them run_Sequential is making https requests sequential and function run_Parallel is doing same things but in parallel&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;rxjs&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;forkJoin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lastValueFrom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;map&lt;/span&gt;

&lt;span class="n"&gt;ids&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_Sequential&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;requestId&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;ids&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;httpGet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://jsonplaceholder.typicode.com/posts/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_Parallel&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;httpRequests&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ids&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;requestId&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;httpRequest&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GET&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://jsonplaceholder.typicode.com/posts/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                                                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                                                    &lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;requestId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
                                                &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;lastValueFrom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;forkJoin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;httpRequests&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;entryFunction&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;sequential&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;run_Sequential&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="n"&gt;parallel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;run_Parallel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Working example is here &lt;br&gt;
&lt;a href="https://run.worksheet.systems/data-studio/app/guest/jspy-playground?file=http-calls%2Fsequential-vs-parallel-http-calls.jspy" rel="noopener noreferrer"&gt;https://run.worksheet.systems/data-studio/app/guest/jspy-playground?file=http-calls%2Fsequential-vs-parallel-http-calls.jspy&lt;/a&gt;.&lt;br&gt;
Just Run this code and open chrome dev-tools - network tab. Where you can clearly see the difference&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmdhd0vg9boqve2kt8zn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmdhd0vg9boqve2kt8zn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  WORKSHEETS Data Studio
&lt;/h2&gt;

&lt;p&gt;WORKSHEETS Data Studio is a Low Code Data Management Platform for Data Analysis, Data Processing, SQL Database Management and RAPID App Development.&lt;/p&gt;

</description>
      <category>api</category>
      <category>http</category>
      <category>programming</category>
      <category>jspython</category>
    </item>
    <item>
      <title>Online SQL Client for low code data management</title>
      <dc:creator>Pavlo Paska</dc:creator>
      <pubDate>Sun, 21 Aug 2022 11:37:00 +0000</pubDate>
      <link>https://dev.to/pavlopaska/online-sql-client-for-low-code-data-management-kk3</link>
      <guid>https://dev.to/pavlopaska/online-sql-client-for-low-code-data-management-kk3</guid>
      <description>&lt;p&gt;There are many good tools to access and work with relational databases. My favourite ones were MS SQL Management Studio and Azure Data Studio. However, several features can make exploring, analysing and working with SQL databases much better and easier.&lt;/p&gt;

&lt;p&gt;We wanted to go a bit further, beyond a SQL query, beyond simple views or CRUD operations. We wanted to give people tools to leverage SQL robustness and power to allow anybody with fundamental data engineering skills (like citizen developers, business analysts, data analysts and even business people) a low code platform to make robust data management tasks much more straightforward.&lt;/p&gt;

&lt;p&gt;We’ve introduced an online SQL client as a core part of WORKSHEETS Data Studio — our low code data management platform. Keeping your data in the database is fundamental to any data-centric IT solution.&lt;/p&gt;

&lt;p&gt;WORKSHEETS Data Studio can be accessed in your browser straight away. So, to get started, you don’t need anything to install.&lt;/p&gt;

&lt;h2&gt;
  
  
  Short video intro
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/embed/cm56EZ-5bFc"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DYg7OGXI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://img.youtube.com/vi/cm56EZ-5bFc/0.jpg" alt="Online SQL Client" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have apparent features, like a tree with data objects, SQL editor with auto-complete, a result panel and everything else you can find in other conventional RMDB tools. However, I would like to highlight the following features:&lt;/p&gt;

&lt;h2&gt;
  
  
  Share and Collaborate
&lt;/h2&gt;

&lt;p&gt;Since WORKSHEETS Data Studio is a web (browser-based) tool, sharing and collaboration are native features. You can create appealing user stories and share them with the world with a single URL. A URL contains all your filters, sorting and columns and makes it very useful when you want to share a link. This will allow other people to see the same information as you see it. In addition, you can permit access to your database for individual users and groups or even grant public access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Easily navigate and search.
&lt;/h2&gt;

&lt;p&gt;VSCode-inspired WORKSHEET Data Studio layout, and you’ll find a lot of similarities, e.g. Tabs, Sidebar etc. However, the most incredible feature is a search box. A single textbox where you can find and navigate to any database object (table/view/stored procedure) within all databases you are connected to. So you don’t have to click and scroll anymore. Just type in whatever you are looking for&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Visualization and Data Analysis
&lt;/h2&gt;

&lt;p&gt;Once you have found your table/view, you can see data in the excel-like data grids and even plot charts for quick exploratory data analysis and modifications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Excel-like filter for each column.
&lt;/h3&gt;

&lt;p&gt;By default, we are showing only the first 1000 rows (you can remove this restriction). So, you can use your filters for each column. Here are two useful features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A unique list of values&lt;/li&gt;
&lt;li&gt;You can workout either this column is unique or not&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All filters added up, and a summary is shown in the bottom left corner&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S-R3qrqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qlvj5wifbqb07c9pobu3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S-R3qrqY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qlvj5wifbqb07c9pobu3.png" alt="SQL Table View" width="700" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the picture above, you can tell that the table SampleSupersureSales has 8,399 rows. And you can see 821 rows WHERE Customer Segment is ‘Small Business’ or ‘Consumer’ and Product Category equal ‘Technology’. Also, from the header filter (like in excel), you can find a breakdown of 21 countries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Join tables together
&lt;/h2&gt;

&lt;p&gt;We know how important it is to combine pieces of information and get a holistic data view. You can effortlessly join or extend tables even if you don’t have DDL access. Just use a visual editor. Then effortlessly share with your colleagues or customers with a simple URL&lt;/p&gt;

&lt;p&gt;You can use a visual Query Manager to join tables/views, select columns from a joined table and specify field expressions if needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--odt7fziJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dritnlszm1fwbincpq2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--odt7fziJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dritnlszm1fwbincpq2.png" alt="A Query Manager to join tables together" width="700" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, from the visual query designer, you can generate SQL Query or JSPython code with SQL-Data-API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dsHGu6N---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fot73klmsuz91ezfrqn9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dsHGu6N---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fot73klmsuz91ezfrqn9.png" alt="Generate Code" width="313" height="239"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Generated SQL Code will look like&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uZkcg0Mb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pdp95dne3wsh3mg30bv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uZkcg0Mb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pdp95dne3wsh3mg30bv.png" alt="Preview generated code" width="700" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or you can easily plot any table data into a graph for better visibility and storytelling.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w7TD7IUt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4zejh2c9am0k89ln9paq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w7TD7IUt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4zejh2c9am0k89ln9paq.png" alt="Plot graph data" width="700" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Linked Views
&lt;/h2&gt;

&lt;p&gt;Joining, filtering and customising your data is an essential data exploration practice. However, sometimes you need to provide a comprehensive view of data. So, you can filter data in the connected views in other browsers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--92WqWheb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxy4huya2jqevnrxji7z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--92WqWheb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxy4huya2jqevnrxji7z.png" alt="Linked Views" width="700" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This picture shows that the left-side browser can control/filter data in 3 other browsers. This everyday use case explores master details data or other dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Import from excel or files
&lt;/h2&gt;

&lt;p&gt;As part of WORKSHEETS Data Studio, you can leverage a low code programming language, JSPython or several UI tools to comprehensively import data from files or other systems and map them to the table fields.&lt;/p&gt;

&lt;h2&gt;
  
  
  Access your Database via REST API
&lt;/h2&gt;

&lt;p&gt;Your SQL Database will be available through RESTfull API for better integration. In addition, we have open source libraries for JSPython, JavaScript, C# and Python.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6BK9Gh9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6i21lst0l08azigcxh4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6BK9Gh9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6i21lst0l08azigcxh4z.png" alt="SQL Data Api" width="700" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SQL Data API is a central access point to control access to your databases through a REST API (HTTPS). Here is a &lt;a href="https://github.com/FalconSoft/sql-data-api-client-js"&gt;SQL Data API JavaScript client&lt;/a&gt; or &lt;a href="https://run.worksheet.systems/data-studio/app/PublicData/SqlDataApiTesting?file=app.jspy"&gt;JSPython test harnesses&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Role-Based Access Control
&lt;/h2&gt;

&lt;p&gt;On top of existing SQL Security, we add another layer to securely control access to your database for authorised users or public access.&lt;/p&gt;

&lt;h2&gt;
  
  
  In the cloud or on-premise
&lt;/h2&gt;

&lt;p&gt;The Enterprise version is available for your servers or in a private/public cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  One tool many databases
&lt;/h2&gt;

&lt;p&gt;We are aiming to support all relational databases. We currently have the full support of MS SQL, AzureSQL and PostgreSQL (beta). But, we are going to add MySQL, Oracle etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL Data-Driven Workflow
&lt;/h2&gt;

&lt;p&gt;Automate and streamline SQL Data-Driven Workflow and custom ETL pipelines.&lt;/p&gt;

&lt;h2&gt;
  
  
  Excel plug-in
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://appsource.microsoft.com/en-gb/product/office/WA104381608?tab=Overview"&gt;WORKSHEETS Data Studio AddIn&lt;/a&gt; provides a flexible and controlled way to access and store your spreadsheet data to and from SQL Database&lt;/p&gt;

&lt;h2&gt;
  
  
  How can I use WORKSHEETS Data Studio?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Online (run.worksheet.systems). Just type in &lt;a href="https://run.worksheet.systems/"&gt;run.worksheet.systems&lt;/a&gt;, and you can access any private or public database. Works well with AzureSQL, AWS SQL, Google Cloud SQL&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://chrome.google.com/webstore/detail/worksheets-data-studio/dkhnlgcpdiifkfjdjceogenclkdfbonh"&gt;Chrome Extention&lt;/a&gt;. Same things just delivered as a chrome-extension&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://worksheet.systems/contact-us"&gt;Enterprise&lt;/a&gt;. You can have your version of WORKSHEETS Data Studio behind your firewalls, comply with your security policies etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can try &lt;a href="https://docs.microsoft.com/en-us/azure/azure-sql/database/free-sql-db-free-account-how-to-deploy?view=azuresql"&gt;Azure SQL Database free with an Azure free account&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;WORKSHEETS Data Studio simplifies your day-to-day data management tasks. And makes working with SQL databases with ease, control and confidence.&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://www.worksheet.systems/blog/online-sql-client-for-low-code-data-management"&gt;https://www.worksheet.systems/blog/online-sql-client-for-low-code-data-management&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>dataengineering</category>
      <category>lowcode</category>
    </item>
    <item>
      <title>How to import JSON file into SQL Server Database</title>
      <dc:creator>Pavlo Paska</dc:creator>
      <pubDate>Tue, 28 Jun 2022 08:19:12 +0000</pubDate>
      <link>https://dev.to/pavlopaska/how-to-import-json-file-into-sql-server-database-1bl8</link>
      <guid>https://dev.to/pavlopaska/how-to-import-json-file-into-sql-server-database-1bl8</guid>
      <description>&lt;p&gt;The JSON format is very friendly for both people and for machines. In other words, it is very well structured for people to read as well as you can parse it quickly with any programming language.&lt;/p&gt;

&lt;p&gt;However, all important information is better stored in relational SQL databases. In relational databases, all information is stored in tables, which consist of rows and columns. So, we will have to break down our JSON file into rows and columns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Supporting Video tutorial
&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://www.youtube.com/watch?v=ysxOEVfHz0E"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5B7Xb3yV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://img.youtube.com/vi/ysxOEVfHz0E/0.jpg" alt="Import JSON format into SQL Server Database" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is very easy to do with WORKSHEETS Data Studio. Just go to &lt;a href="https://run.worksheet.systems/data-studio/app/-guest-/-untitled-app?file=(new)-untitled-1.json"&gt;JSON editor&lt;/a&gt; and open the JSON file or paste a valid JSON data into the editor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SQjGwBah--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnchbsvzfqp2cxb57p1y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SQjGwBah--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnchbsvzfqp2cxb57p1y.png" alt="Image description" width="880" height="705"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will instantly see in a right-hand panel, that your JSON had been rendered into the data grid which has a table structure. Each element from an array is a row and each property is a column. Any nested objects are kept in a valid JSON format.&lt;/p&gt;

&lt;p&gt;Please note. You have to have a valid SQL connection&lt;/p&gt;

&lt;p&gt;So, we are ready to save this to the database. Press the &lt;code&gt;Save To Database&lt;/code&gt; menu item. Choose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL Connection, schema, tableName.&lt;/li&gt;
&lt;li&gt;Make sure field mapping is correct&lt;/li&gt;
&lt;li&gt;Choose the primary key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0YNDqiWF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wpbq2nq9b64av3pewjh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0YNDqiWF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wpbq2nq9b64av3pewjh.png" alt="Image description" width="880" height="670"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and you are ready to save.&lt;/p&gt;

&lt;p&gt;We have 3 ways to save :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Upsert / Merge - So, it will insert or update rows in your table, based on a primary key(s). this is the default way and will work well in most cases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Append - it will append only your data. A bit more performance optimized&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bulk Insert - it delivers the best performance. But, you will have to ensure data integrity&lt;br&gt;
In a bit more advanced scenarios you may want to change the structure of your&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Use JSPython to save JSON Data to SQL Database
&lt;/h2&gt;

&lt;p&gt;If you need more flexibility and control, you can use JSPython to import your data. You can use &lt;a href="https://github.com/FalconSoft/sql-data-api-client-js#saving-data"&gt;SQL Data Api library&lt;/a&gt; to save. Also, you can save JSON to Worksheets Data Studio project and then import it into a jspy file for further processing&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y5LWZVh4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbr9tqawrnt3s1khik00.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y5LWZVh4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbr9tqawrnt3s1khik00.png" alt="Image description" width="862" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Open JSON file and process it
&lt;/h2&gt;

&lt;p&gt;You can use &lt;code&gt;openFileAsArray&lt;/code&gt; function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;openFileAsArray&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Transform JSON Data
&lt;/h2&gt;

&lt;p&gt;You can save JSON data in the projects and then import it into JSPython&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# transform object if needed
&lt;/span&gt;&lt;span class="n"&gt;fileData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;openFileAsArray&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fileData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fileData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;avg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Save Data To SQL
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Welcome to JSPython (https://jspython.dev)
&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;sqlDataApi&lt;/span&gt;

&lt;span class="n"&gt;fileData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;openFileAsArray&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fileData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fileData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;avg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;sqlDataApi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'public-data-connect'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'publicData.table2Ex'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Importing large JSON file
&lt;/h2&gt;

&lt;p&gt;We do not recommend storing/loading large JSON files, because your browsers will run out of memory and crash. The previous article demonstrated how you can work with large JSON files. In this article, I will show you how you can import large JSON files into smaller chunks.&lt;/p&gt;

&lt;p&gt;Here is a JSPython:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;sqlDataApi&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;saveItemsToDatabase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;#add fileName for each element
&lt;/span&gt;    &lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="c1"&gt;# save it to the database
&lt;/span&gt;    &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sqlDataApi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'connectionName'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'schema.tableName'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;openFileAsArray&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="n"&gt;chunkProcessor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;saveItemsToDatabase&lt;/span&gt;
    &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As in a previous example, we use the &lt;code&gt;openFileAsArray&lt;/code&gt; function. Where we define a &lt;code&gt;chunkProcessor&lt;/code&gt; function, which uses &lt;code&gt;sql-data-api&lt;/code&gt; to save items to the database. Meanwhile, as in this example, we are transforming elements and adding the fileName field.&lt;/p&gt;

&lt;p&gt;Before running this code, you have to have SQL Connection defined and which has a table with a conforming structure. If you are running a large file, you can always open the first 1000 (or 10000) rows and use the &lt;code&gt;Save To Database&lt;/code&gt; functionality to create a new table with all fields. Please make sure that varchar length and datatype can accommodate all rows in a file&lt;/p&gt;

&lt;h2&gt;
  
  
  WORKSHEETS Data Studio
&lt;/h2&gt;

&lt;p&gt;WORKSHEETS Data Studio is a low-code data management studio which makes it easy to work with different kinds of files and we have straightforward processes to load JSON data into the database&lt;/p&gt;

</description>
      <category>json</category>
      <category>sql</category>
      <category>database</category>
      <category>etl</category>
    </item>
    <item>
      <title>How to open and analyse large JSON files online</title>
      <dc:creator>Pavlo Paska</dc:creator>
      <pubDate>Tue, 07 Jun 2022 08:58:52 +0000</pubDate>
      <link>https://dev.to/pavlopaska/how-to-open-and-analyse-large-json-files-online-b08</link>
      <guid>https://dev.to/pavlopaska/how-to-open-and-analyse-large-json-files-online-b08</guid>
      <description>&lt;p&gt;The main issue with large files is that we can’t load them entirely into the memory. It is easy to get &lt;code&gt;out-of-memory&lt;/code&gt; error and crash. And obviously, all JSON parsers in all languages will run &lt;code&gt;out-of-memory&lt;/code&gt; exception in no time. Any file larger than 100M is difficult and in most cases impossible to analyse.&lt;/p&gt;

&lt;p&gt;JSON is a popular text-based format in the industry. Which represents a structured data-based object. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa)&lt;/p&gt;

&lt;p&gt;Also, it works well with &lt;a href="https://docs.servicestack.net/jsv-format" rel="noopener noreferrer"&gt;JSV format&lt;/a&gt; — JSV Text Format (JSON + CSV) is a text-based format developed by the ServiceStack team and is optimized for both size and speed.&lt;/p&gt;

&lt;p&gt;So, our goal here is to demonstrate to you how you can use WORKSHEETS Data Studio to process and analyse large JSON files straight in your browser (tested with JSON files up to 4G).&lt;/p&gt;

&lt;p&gt;As I mentioned before, we can’t afford to load the entire file into the memory. So, how are we going to analyse then? There are a few tricks we can apply:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limit&lt;/strong&gt; result set to 100, 1000, or any other reasonable amount.&lt;/li&gt;
&lt;li&gt;Get &lt;strong&gt;distinct&lt;/strong&gt; values for one of the fields.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply filter&lt;/strong&gt; criteria and reduce element count.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transform&lt;/strong&gt; each element and reduce the size you are loading.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these actions you can do in your browser with Worksheets Data Studio and no installations are required. You can find it online: &lt;a href="https://run.worksheet.systems" rel="noopener noreferrer"&gt;https://run.worksheet.systems&lt;/a&gt; or &lt;a href="https://chrome.google.com/webstore/detail/worksheets-data-studio/dkhnlgcpdiifkfjdjceogenclkdfbonh?hl=en" rel="noopener noreferrer"&gt;Chrome Extension&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two ways you can process JSON files:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use JSON editor to open/process files&lt;/li&gt;
&lt;li&gt;Use JSPython. It is a more advanced way of processing files. Where you can program more logic into it. You can use the function &lt;strong&gt;openFileAsArray&lt;/strong&gt; where you can choose file from the disk and parse data partially with all control you need. Function &lt;code&gt;openFileAsArray&lt;/code&gt; comes with following parameters:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;take&lt;/strong&gt; and &lt;strong&gt;skip&lt;/strong&gt; — specify how many items you want to take or to skip. This will allow you to &lt;code&gt;page&lt;/code&gt; big JSON file&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;distinct&lt;/strong&gt; — if the distinct field is defined, then the function will return unique values for this field&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;containsText&lt;/strong&gt; — filter results by searching text before parsing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;filterText&lt;/strong&gt; — a callback predicate function where you can have pre-parsed string and define filter criteria&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;filter&lt;/strong&gt; — a callback predicate function where you can define filter criteria with parsed element object&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;map&lt;/strong&gt; — a callback function where you can define/changes result items&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;chunkSize&lt;/strong&gt; — define a chunk size we are processing at a time. By default it is 64 * 1024 * 1024 (64K)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;chunkProcessor&lt;/strong&gt; — a callback function where you can handle a parsed chunk of items. If this function is defined, then we will not return items. You will have to process a batch of items yourself. In one of the use cases, you can save a batch of items to the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's review all 4 use cases and I will demonstrate all available approaches:&lt;/p&gt;

&lt;h2&gt;
  
  
  Limit elements count
&lt;/h2&gt;

&lt;p&gt;A good starting point is to look for a small number of elements, lets's say you want to see only 1000 elements and figure out the element’s structure and decide your future steps for analysis:&lt;/p&gt;

&lt;h3&gt;
  
  
  Use JSON editor in Worksheets Data Studio
&lt;/h3&gt;

&lt;p&gt;Open new &lt;a href="https://run.worksheet.systems/data-studio/app/test1/-untitled-app?file=(new)-untitled-1.json" rel="noopener noreferrer"&gt;blank JSON tab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3gpcs0s1vzr85fw7jsf4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3gpcs0s1vzr85fw7jsf4.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the top right corner, you will notice the button &lt;code&gt;Open File&lt;/code&gt; and &lt;code&gt;Open file partially&lt;/code&gt;. Where the first button will open and load the entire JSON/JSV/CSV file into JSON Editor. And button &lt;code&gt;Open file partially&lt;/code&gt; will open the following dialog, which will allow you to work with large files&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F777ct8bfyyvr4zy3a1xq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F777ct8bfyyvr4zy3a1xq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you press &lt;code&gt;Open File&lt;/code&gt; button. You will be able to see the first 1000 elements from your JSON file. This is very helpful to analyze file structure and decide on further analysis actions&lt;/p&gt;

&lt;p&gt;If you press &lt;code&gt;Open File&lt;/code&gt; button. You will be able to see the first 1000 elements from your JSON file. This is very helpful to analyze file structure and decide on further analysis actions&lt;/p&gt;

&lt;h3&gt;
  
  
  Use JSPython
&lt;/h3&gt;

&lt;p&gt;Alternatively, you can use JSPython editor and programmatically handle results. Function&lt;code&gt;openFileAsArray&lt;/code&gt; will open the same dialog and will return processed elements results for further data manipulations in JSPython.&lt;/p&gt;

&lt;p&gt;Here is an example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Welcome to JSPython (https://jspython.dev) 
&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;openFileAsArray&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; 
   &lt;span class="n"&gt;take&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; 
   &lt;span class="c1"&gt;#skip: 1000 
&lt;/span&gt;&lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; 
&lt;span class="c1"&gt;# work with data array here 
&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Get Distinct values
&lt;/h2&gt;

&lt;p&gt;After you’ve seen a file structure and the top 1000 elements in your JSON file. Next, you would be probably more interested to see unique values for some of the fields. Let’s say, in our example, you would be interested to see the unique &lt;code&gt;Product_ID&lt;/code&gt; in the file&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2842ydyeuhc7s3hpdj3s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2842ydyeuhc7s3hpdj3s.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or you can achieve the same result with JSPython code&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjw5n98tzvh95t2oippqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjw5n98tzvh95t2oippqz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Apply filter criteria
&lt;/h2&gt;

&lt;p&gt;And now, when you’ve seen a chunk of your JSON file and analyzed unique values from this file. You should know enough to filter and get whatever is needed for your analysis.&lt;br&gt;
Let's say you want to see only elements that contain the text &lt;code&gt;InterestRate:CrossCurrency:FixedFloat&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then you can specify in the dialog:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cp08ulp9z4dmhte9n6e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cp08ulp9z4dmhte9n6e.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or with JSPython you can define a predicate function with more advanced filter criteria. you can add extra filter criteria e.g. Action == ‘CANCEL’&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffj5mi4so7ljad269xqd9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffj5mi4so7ljad269xqd9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Transform results
&lt;/h2&gt;

&lt;p&gt;One other way of reducing memory footprint is to remove some of the fields for each element. Especially, if some of the fields are not important. This option is available only with JSPython code&lt;/p&gt;

&lt;p&gt;Here is JSPython example with filter callback and transformation map&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;openFileAsArray&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; 
  &lt;span class="nb"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; 
     &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Product_ID&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;InterestRate:CrossCurrency:FixedFloat&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; 
       &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Action&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;CANCEL&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
     &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Dissemination_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;effectiveDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;dateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Effective_Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
     &lt;span class="n"&gt;notional&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Notional_Amount_1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="n"&gt;notionalCcy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Notional_Currency_1&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and eventually, results will look like&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2krnu90tomd1d24iltei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2krnu90tomd1d24iltei.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Video tutorial
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://youtu.be/j1ro4VJZoDA" rel="noopener noreferrer"&gt;https://youtu.be/j1ro4VJZoDA&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;WORKSHEETS Data Studio simplifies working with large JSON files or even, sometimes, is the only option to view and analyse large JSON file. However, the best way to analyze big files will be to load the entire file into an SQL database and then use SQL queries to analyze much more effectively. This is something we will show you how to do in the next tutorial.&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://www.worksheet.systems/blog/how-to-open-and-analyse-large-json-file-online" rel="noopener noreferrer"&gt;https://www.worksheet.systems&lt;/a&gt;&lt;/p&gt;

</description>
      <category>json</category>
      <category>database</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Why we introduced our new coding language - JSPython?</title>
      <dc:creator>Pavlo Paska</dc:creator>
      <pubDate>Sat, 07 Aug 2021 09:26:45 +0000</pubDate>
      <link>https://dev.to/pavlopaska/why-we-introduced-our-new-coding-language-jspython-p</link>
      <guid>https://dev.to/pavlopaska/why-we-introduced-our-new-coding-language-jspython-p</guid>
      <description>&lt;p&gt;I’ve worked with a dozen programming languages during my career in software development. Anything from Basic, Pascal, C* to Python, JavaScript, and more. And here we are, fast forward 25 years and I had no other option than to invent another coding language. With all questions asking, ‘why?’&lt;/p&gt;

&lt;p&gt;Do we want to learn another programming language? - No, Python is the most popular language in the world&lt;/p&gt;

&lt;p&gt;Do we have time to rebuild libraries for all the needs? - No, JavaScript has huge communities and a huge EcoSystem around it.&lt;/p&gt;

&lt;p&gt;We had a requirement to allow users to define custom logic at runtime safely. We tried a JSON-based configuration, but, as complexities grew, that configuration became unmaintainable. Even UI-based drag’n drop interfaces become messy for bigger and more complex logic. And after a few failed attempts I decided to build my interpreter and introduce a new coding language to the world. And syntax-wise I choose to start with Python as it is the most familiar syntax among our target audience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://jspython.dev/"&gt;JSPython&lt;/a&gt; is a python-like syntax interpreter implemented with javascript that runs entirely in the web browser and/or in the NodeJS environment. It does not transpile/compile your code into JavaScript, instead, it provides an interactive interpreter that reads Python-like code and carries out its instructions. With JSPython you should be able to safely interact with any JavaScript libraries or API’s with the popular Python-like syntax.&lt;/p&gt;

&lt;p&gt;With JSPython you can use any JavaScript library with Python-like syntax. You can use standard Javascript objects, arrays, callback functions, as well as build your custom logic with JavaScript and expose it to JSPython users&lt;/p&gt;

&lt;h2&gt;
  
  
  Main advantages of JSPython
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Safe scripting environment.&lt;/em&gt; You have full control over what functions and libraries you expose to JSPython and allow users to use.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Works in a browser as well as offline on the server-side.&lt;/em&gt; You can integrate it easily with your web app in the browser and/or run jspy files offline with jspython-cli in the NodeJS environment&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;The python-like syntax.&lt;/em&gt; Most of the language features (syntax, indentation, and expressions) are mirrored from Python. Also, added a few extras like Multiline lambdas, Null coalescing, single line conditions, etc&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Utilize the entire JavaScript ecosystem.&lt;/em&gt; Leverage a massive JavaScript ecosystem with Python scripting. You should be able to import and invoke any JS function with the Python syntax&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Rapid Application Development.&lt;/em&gt; The seamless interaction between Python and JavaScript allows developers to enjoy the best of two worlds. And deliver business solutions much quicker and more reliably.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to start?
&lt;/h2&gt;

&lt;p&gt;JSPython is an &lt;a href="https://github.com/jspython-dev/jspython"&gt;open source JavaScript library&lt;/a&gt; with a permissive BSD 3-Clause License. Published to npm as jspython-interpreter&lt;/p&gt;

&lt;h3&gt;
  
  
  Run JSPython in your JavaScript App
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;npm install jspython-interpreter&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;jsPython&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;print("Hello World!")&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;            
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Result =&amp;gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;            
    &lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Error =&amp;gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;            
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Run JSPython in NodeJS with JSPython-CLI
&lt;/h3&gt;

&lt;p&gt;Use &lt;a href="https://github.com/jspython-dev/jspython-cli"&gt;JSPython-cli command line tool&lt;/a&gt; what allows you to run JSPython in NodeJS environment&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;jspython --file=path/to/jspython/file --param1=value --param&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Any similar projects around?
&lt;/h2&gt;

&lt;p&gt;Obviously, before committing to such a big endeavour I’ve looked around for existing libraries. The closest library is Skulpt but their API isn’t flexible enough and we couldn’t utilize our JavaScript libraries&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance
&lt;/h2&gt;

&lt;p&gt;Many people are asking about performance and maturity of the project. How does it compare to Python performance-wise?&lt;/p&gt;

&lt;p&gt;Well, it is very comparable to CPython, mainly because CPython is quite slow :), while Google’s V8 JavaScript engine is extremely optimized and performant. You will find that NodeJS will significantly outperform any CPython project. So, I can confidently say that JSPython is fast enough to serve most of your custom workflow and behaviour logic. And is already used in several performance critical production systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coding playground
&lt;/h2&gt;

&lt;p&gt;Check out our basic playground &lt;a href="https://jspython.dev/playground"&gt;https://jspython.dev/playground&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or more advanced examples build with &lt;a href="https://run.worksheet.systems/data-studio/app/guest/jspy-playground?file=examples%2Fsimple-jspy%2Fworking-with-arrays.jspy"&gt;WORKSHEETS Data Studio&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  sample code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# initial array
&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="s"&gt;""" 
You can use all standard JavaScript functions 
(https://www.w3schools.com/jsref/jsref_obj_array.asp). 
"""&lt;/span&gt;

&lt;span class="c1"&gt;# add more numbers
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# `filter` will leave only odd numbers
# `map` will create an object
# y will be an array of objects transformed from odd numbers
&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;newItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;element&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;square&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="n"&gt;cube&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newItem&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;     


&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Prints to console =&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# last statement will be a result
&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Worksheet Systems
&lt;/h2&gt;

&lt;p&gt;JSPython was build to power our low code data management platform - &lt;a href="https://worksheet.systems"&gt;Worksheet Systems.&lt;/a&gt; Which allows anybody to build database applications with ease, control and confidence. JSPython is used as a primary low code language to define UI behaviours, validations, build data transformational pipelines and much more.&lt;/p&gt;

&lt;p&gt;However, it is open source project with &lt;a href="https://github.com/jspython-dev/jspython/blob/DEV-v2/LICENSE"&gt;a permissive BSD 3-Clause License.&lt;/a&gt; So, feel free to adopt it into your own projects.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>python</category>
      <category>showdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
