Could a hybrid data model, like using JSON in fields, allow us to eliminate the need for EAV within something...












0















I was reading about EAV, and what options are available to avoid the pain caused by it, and stumbled upon using JSON in fields.



This mariadb feature page shows an example like,



SELECT name,
JSON_VALUE(attr, "$.email.personal") AS email,
JSON_VALUE(attr, "$.social.twitter") AS twitter,
JSON_VALUE(attr, "$.interests[0]") AS favorite_interest
FROM tbl_user_profiles
WHERE user_id = "sjohnson";


The JSON is the part that would be a problem, if it was defined in a relational table's schema. Is this really as viable as it looks at first glance?










share|improve this question





























    0















    I was reading about EAV, and what options are available to avoid the pain caused by it, and stumbled upon using JSON in fields.



    This mariadb feature page shows an example like,



    SELECT name,
    JSON_VALUE(attr, "$.email.personal") AS email,
    JSON_VALUE(attr, "$.social.twitter") AS twitter,
    JSON_VALUE(attr, "$.interests[0]") AS favorite_interest
    FROM tbl_user_profiles
    WHERE user_id = "sjohnson";


    The JSON is the part that would be a problem, if it was defined in a relational table's schema. Is this really as viable as it looks at first glance?










    share|improve this question



























      0












      0








      0








      I was reading about EAV, and what options are available to avoid the pain caused by it, and stumbled upon using JSON in fields.



      This mariadb feature page shows an example like,



      SELECT name,
      JSON_VALUE(attr, "$.email.personal") AS email,
      JSON_VALUE(attr, "$.social.twitter") AS twitter,
      JSON_VALUE(attr, "$.interests[0]") AS favorite_interest
      FROM tbl_user_profiles
      WHERE user_id = "sjohnson";


      The JSON is the part that would be a problem, if it was defined in a relational table's schema. Is this really as viable as it looks at first glance?










      share|improve this question
















      I was reading about EAV, and what options are available to avoid the pain caused by it, and stumbled upon using JSON in fields.



      This mariadb feature page shows an example like,



      SELECT name,
      JSON_VALUE(attr, "$.email.personal") AS email,
      JSON_VALUE(attr, "$.social.twitter") AS twitter,
      JSON_VALUE(attr, "$.interests[0]") AS favorite_interest
      FROM tbl_user_profiles
      WHERE user_id = "sjohnson";


      The JSON is the part that would be a problem, if it was defined in a relational table's schema. Is this really as viable as it looks at first glance?







      magento2 database eav json






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 23 mins ago









      Shoaib Munir

      654318




      654318










      asked Dec 28 '18 at 19:44









      J. M. BeckerJ. M. Becker

      12117




      12117






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Yes, It can.



          But because it is a huge backward incompatible change it cannot be implemented in core in the nearest future



          Also if you decide to switch to schema less data it is better to switch to document database like MangoDB






          share|improve this answer
























          • MongoDB would be a mistake IMO, for a few solid reasons. First it doesn't provide a standardized query language, it also doesn't fit the requirements as well, because almost all of the data in Magento 2 really is relational. Only the additional attributes don't fit well in a relational model. The cost of not using a relational model means querying becomes has to be more complex, and push more work to the application layer, which is already required for the EAVs.

            – J. M. Becker
            Dec 29 '18 at 0:22













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f256113%2fcould-a-hybrid-data-model-like-using-json-in-fields-allow-us-to-eliminate-the%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Yes, It can.



          But because it is a huge backward incompatible change it cannot be implemented in core in the nearest future



          Also if you decide to switch to schema less data it is better to switch to document database like MangoDB






          share|improve this answer
























          • MongoDB would be a mistake IMO, for a few solid reasons. First it doesn't provide a standardized query language, it also doesn't fit the requirements as well, because almost all of the data in Magento 2 really is relational. Only the additional attributes don't fit well in a relational model. The cost of not using a relational model means querying becomes has to be more complex, and push more work to the application layer, which is already required for the EAVs.

            – J. M. Becker
            Dec 29 '18 at 0:22


















          0














          Yes, It can.



          But because it is a huge backward incompatible change it cannot be implemented in core in the nearest future



          Also if you decide to switch to schema less data it is better to switch to document database like MangoDB






          share|improve this answer
























          • MongoDB would be a mistake IMO, for a few solid reasons. First it doesn't provide a standardized query language, it also doesn't fit the requirements as well, because almost all of the data in Magento 2 really is relational. Only the additional attributes don't fit well in a relational model. The cost of not using a relational model means querying becomes has to be more complex, and push more work to the application layer, which is already required for the EAVs.

            – J. M. Becker
            Dec 29 '18 at 0:22
















          0












          0








          0







          Yes, It can.



          But because it is a huge backward incompatible change it cannot be implemented in core in the nearest future



          Also if you decide to switch to schema less data it is better to switch to document database like MangoDB






          share|improve this answer













          Yes, It can.



          But because it is a huge backward incompatible change it cannot be implemented in core in the nearest future



          Also if you decide to switch to schema less data it is better to switch to document database like MangoDB







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 28 '18 at 20:25









          KAndyKAndy

          15.6k23044




          15.6k23044













          • MongoDB would be a mistake IMO, for a few solid reasons. First it doesn't provide a standardized query language, it also doesn't fit the requirements as well, because almost all of the data in Magento 2 really is relational. Only the additional attributes don't fit well in a relational model. The cost of not using a relational model means querying becomes has to be more complex, and push more work to the application layer, which is already required for the EAVs.

            – J. M. Becker
            Dec 29 '18 at 0:22





















          • MongoDB would be a mistake IMO, for a few solid reasons. First it doesn't provide a standardized query language, it also doesn't fit the requirements as well, because almost all of the data in Magento 2 really is relational. Only the additional attributes don't fit well in a relational model. The cost of not using a relational model means querying becomes has to be more complex, and push more work to the application layer, which is already required for the EAVs.

            – J. M. Becker
            Dec 29 '18 at 0:22



















          MongoDB would be a mistake IMO, for a few solid reasons. First it doesn't provide a standardized query language, it also doesn't fit the requirements as well, because almost all of the data in Magento 2 really is relational. Only the additional attributes don't fit well in a relational model. The cost of not using a relational model means querying becomes has to be more complex, and push more work to the application layer, which is already required for the EAVs.

          – J. M. Becker
          Dec 29 '18 at 0:22







          MongoDB would be a mistake IMO, for a few solid reasons. First it doesn't provide a standardized query language, it also doesn't fit the requirements as well, because almost all of the data in Magento 2 really is relational. Only the additional attributes don't fit well in a relational model. The cost of not using a relational model means querying becomes has to be more complex, and push more work to the application layer, which is already required for the EAVs.

          – J. M. Becker
          Dec 29 '18 at 0:22




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f256113%2fcould-a-hybrid-data-model-like-using-json-in-fields-allow-us-to-eliminate-the%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Polycentropodidae

          Magento 2 Error message: Invalid state change requested

          Paulmy