paint-brush
SQL Queries: Why You Need SQL-Agnostic Parsingby@yacinesitayeb
599 reads
599 reads

SQL Queries: Why You Need SQL-Agnostic Parsing

by Yacine Si TayebApril 5th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

It’s not an Oracle-only world today. Database-agnostic querying is necessary to allow engineers to focus on the data they need instead of the data access mechanisms at work behind the scenes. Apache ShardingSphere is a typical example.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - SQL Queries: Why You Need SQL-Agnostic Parsing
Yacine Si Tayeb HackerNoon profile picture


Learning how to query data from databases is not just for data scientists, it’s an essential skill for developers, too. Fortunately, NoSQL databases are schema-agnostic. You don’t need to be an expert in thousands of combinations of SQL, data types, and databases to master SQL queries. A good SQL agnostic parser will take care of all but impossible complex queries with ease.


If you want to build full-stack applications, it’s important to create apps that use data from databases. Databases can store varies amounts of information in any format, such as text, images, or video. These data stores need to ‘talk’ with one another. Here the role of SQL agnostic parsing software becomes crucial, enabling databases to work among multiple systems rather than having to create a single customized solution from scratch that will degrade in effectiveness over time.

SQL Agnostic Queries Make It Work

As organizations intake and process an incoming flood of data and traffic, intelligent approaches to managing and querying a database need to be utilized. The proliferation of database types via open-source database software has contributed to the complexity.


It’s not an Oracle-only world today. But even it were, there are still major syntax differences among even the simplest operations across all the major SQL databases. Even though they all implement the same SQL standard. A SQL agnostic query engine can account for all the differences.


Database-agnostic querying is necessary to allow engineers to focus on the data they need instead of the data access mechanisms at work behind the scenes.


To understand the power of SQL, it helps to think about how different types of queries function. For instance: Data Definition Language (DDL), Data Manipulation Language(DML), and Transactions Control Languag (TCL). These all work as an abstract version for various kinds of SQL statements that can be executed across databases and data types.


Agnostic queries focus on answering the important question of ‘what’, rather than ‘how’ or ‘where’ information is stored. It also helps users retrieve information without being database literate. It makes SQL queries much less complex to write. Users see a single unified representation of all the data available to them and get answers in an easy-to-use format.


This doesn't mean that the data retrieved under these queries is not being managed or maintained properly. Data can be in a relational database, a graph, a foreign primary key value, or a time series. Changes in the database schema are continuously tracked and recorded as they always have under standard SQL.

Developers don’t need to know that ‘behind the scenes’ a good SQL agnostic query engine is tracking:


  • The kind of database that houses the data, such as relational or key-value.

  • The particular database instance such as a shard, or a partition

  • The version of the database being used such as PostgeSQL or Microsoft SQL server.


This is the magic and efficiency of using a database access tool that uses SQL agnostic queries.


Example: Apache ShardingSphere

Apache ShardingSphere is an open-source database ecosystem of tools and middleware that makes good use of existing database resources rather than building another new database technology.


Apache ShardingSphere is an open-source ecosystem consisting of a set of distributed database solutions, including 3 independent products, JDBC, Proxy & Sidecar. They all provide functions of data scale out, distributed transaction, and distributed governance functions, applicable in a variety of situations such as Java isomorphism, heterogeneous language, and cloud native.

Apache ShardingSphere is an Apache Top-Level project and is one of the most popular open-source big data projects. It was started about 5 years ago and now has 14K+ stars, over 300 contributors, and 5,100 forks in its community.

Here is an exmaple of a query using ShardingSphere’s SQLParserEngine access tool:


<insert code snippet here>


The queries are more accessible for developers or anyone who wishes to extract information from the database since it's in a format that makes sense, rather than being all over the place with no standard for access.


Advantages of SQL Agnostic Queries

Backing For Unstructured Text

The digital world is changing faster than ever before. It's hard to imagine that there could be so much unstructured data in the world, and yet we're barely scratching the surface. The reality is that 80% or more of all enterprise-level information comes from non-document sources, for example, text messages between employees on their phones.


This means companies need a new approach if they want access to valuable business intelligence about what matters most - without having an entire research staff dedicated solely towards understanding where and how to access the data as it comes in.


Numerous NoSQL data sets can deal with the ordering of unstructured text either as a local element (MarkLogic Server) or a coordinated arrangement of administrations, including Solr or Elasticsearch.


A good SQL agnostic tool is like a Swiss Army knife for your data. It can answer the question of what, when and how much by translating unstructured or disparate elements into something useful that will get you closer to an answer than ever before.


Managing Complexity

Data scientists have persevered in finding ways to solve queries using the power of data for decades. The first step was optimizing databases, which was complicated and time-consuming, done ‘by hand' from memory - but could not handle large multi-table joins without breaking a sweat!


Today's sharding solutions can split up huge tables across many databases so they don't get too heavy on any one server farm or database, but it makes queries more complex. NoSQL parsing software excels at hiding that complexity from users who simply want fast, insightful data retrieval.


Reducing Cost

The NoSQL data sets handle apportioning (sharding) of a single large, unorganized file across servers. This model supports less expensive commodity hardware and software which can result in significant cost savings for organizations. They won’t have to purchase additional server space or storage media with higher prices than is necessary.


To Summarize

  1. SQL is the de facto language used to access many different databases and data types for all of today’s apps.


  2. SQL agnostic queries are now necessary to write applications for multiple databases and data types.


  3. The syntax of SQL agnostic queries is very similar to standard SQL, so it's easy to learn and use. You don't have to switch between languages when you need a new database.


  4. It's easier than ever before because there are more tools like ShardingSphere available for making this process simple and efficient.


  5. Now, no matter what major changes come up with future versions of your favorite data platform, you'll always be able to keep using it without any issues, thanks to SQL agnostic queries.