Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Conversion of a SQL model into a standard item model?
Forum Updated to NodeBB v4.3 + New Features

Conversion of a SQL model into a standard item model?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsqltablemodelqstandarditemmodata modelsproxiessoftware design
35 Posts 5 Posters 8.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E elfring

    May I ask why?

    • Possible change resistance
    • Unclear development efforts (and additional dependencies) for a software transformation to better SQL data models
    VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by
    #4

    @elfring said in Conversion of a SQL model into a standard item model?:

    Possible change resistance

    Deal with it.
    If you mean change in code, by only interacting with QStandardItemModel via the QAbstractItemModel interface as I always suggest, makes changing the model a matter of 1 code line

    Unclear development efforts (and additional dependencies)

    The additional dependency is the SQL module. Hard to get around it if you want to interact with an SQL database

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    E 1 Reply Last reply
    1
    • VRoninV VRonin

      @elfring said in Conversion of a SQL model into a standard item model?:

      Possible change resistance

      Deal with it.
      If you mean change in code, by only interacting with QStandardItemModel via the QAbstractItemModel interface as I always suggest, makes changing the model a matter of 1 code line

      Unclear development efforts (and additional dependencies)

      The additional dependency is the SQL module. Hard to get around it if you want to interact with an SQL database

      E Offline
      E Offline
      elfring
      wrote on last edited by
      #5

      … if you want to interact with an SQL database

      Unfortunately, the Qt software documentation mentions specific limitations for the class “QSqlTableModel” so far.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #6

        Do you mean the ones solved by QSqlRelationalTableModel and QSqlRelationalDelegate mentioned in the documentation you are linking to ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        E 1 Reply Last reply
        1
        • SGaistS SGaist

          Do you mean the ones solved by QSqlRelationalTableModel and QSqlRelationalDelegate mentioned in the documentation you are linking to ?

          E Offline
          E Offline
          elfring
          wrote on last edited by
          #7

          Maybe.

          Do both table model classes share still the main restriction on editing from a single database table?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #8

            It's not a restriction, it's how the class works. QSqlTableModel as it name suggest allows access to one table.

            So what exactly are you after ?
            Specify a real situation
            Specify a real need

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            E 1 Reply Last reply
            3
            • SGaistS SGaist

              It's not a restriction, it's how the class works. QSqlTableModel as it name suggest allows access to one table.

              So what exactly are you after ?
              Specify a real situation
              Specify a real need

              E Offline
              E Offline
              elfring
              wrote on last edited by
              #9

              QSqlTableModel as it name suggest allows access to one table.

              Can such classes collaborate also with database views?

              VRoninV 1 Reply Last reply
              0
              • E elfring

                QSqlTableModel as it name suggest allows access to one table.

                Can such classes collaborate also with database views?

                VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #10

                From the article you linked:

                If the database system can determine the reverse mapping from the view schema to the schema of the underlying base tables, then the view is updatable. INSERT, UPDATE, and DELETE operations can be performed on updatable views.

                Since there's no generic way for a Qt model to know that, it is left to the user to implement using QSqlQuery directly

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                E 1 Reply Last reply
                1
                • VRoninV VRonin

                  From the article you linked:

                  If the database system can determine the reverse mapping from the view schema to the schema of the underlying base tables, then the view is updatable. INSERT, UPDATE, and DELETE operations can be performed on updatable views.

                  Since there's no generic way for a Qt model to know that, it is left to the user to implement using QSqlQuery directly

                  E Offline
                  E Offline
                  elfring
                  wrote on last edited by
                  #11

                  Would it be nicer if a table model can determine if it is based on an updatable view?

                  1 Reply Last reply
                  0
                  • VRoninV Offline
                    VRoninV Offline
                    VRonin
                    wrote on last edited by VRonin
                    #12

                    Yes, but once again

                    @VRonin said in Conversion of a SQL model into a standard item model?:

                    there's no generic way for a Qt model to know that

                    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                    ~Napoleon Bonaparte

                    On a crusade to banish setIndexWidget() from the holy land of Qt

                    E 1 Reply Last reply
                    1
                    • VRoninV VRonin

                      Yes, but once again

                      @VRonin said in Conversion of a SQL model into a standard item model?:

                      there's no generic way for a Qt model to know that

                      E Offline
                      E Offline
                      elfring
                      wrote on last edited by
                      #13

                      Do full-featured standard item models become a bit more attractive then?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #14

                        Attractive for what ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        E 1 Reply Last reply
                        1
                        • SGaistS SGaist

                          Attractive for what ?

                          E Offline
                          E Offline
                          elfring
                          wrote on last edited by
                          #15

                          Would you like to compare the attractiveness of the mentioned data model variants any further?

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #16

                            I'll let you start by providing the analysis you want to discuss about.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            E 1 Reply Last reply
                            3
                            • SGaistS SGaist

                              I'll let you start by providing the analysis you want to discuss about.

                              E Offline
                              E Offline
                              elfring
                              wrote on last edited by
                              #17

                              Is there a “development competition” going on between data processing by SQL queries and/or Qt standard items?

                              JKSHJ 1 Reply Last reply
                              0
                              • E elfring

                                Is there a “development competition” going on between data processing by SQL queries and/or Qt standard items?

                                JKSHJ Offline
                                JKSHJ Offline
                                JKSH
                                Moderators
                                wrote on last edited by JKSH
                                #18

                                @elfring said in Conversion of a SQL model into a standard item model?:

                                Is there a “development competition” going on between data processing by SQL queries and/or Qt standard items?

                                No, there is no competition going on.

                                @elfring, what is your goal for asking us these questions? Are you trying to get us to write a "software extension" for you?

                                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                E 1 Reply Last reply
                                3
                                • JKSHJ JKSH

                                  @elfring said in Conversion of a SQL model into a standard item model?:

                                  Is there a “development competition” going on between data processing by SQL queries and/or Qt standard items?

                                  No, there is no competition going on.

                                  @elfring, what is your goal for asking us these questions? Are you trying to get us to write a "software extension" for you?

                                  E Offline
                                  E Offline
                                  elfring
                                  wrote on last edited by
                                  #19

                                  I hope that more software evolution can happen in this area so that the switching between discussed data models might become easier.

                                  JKSHJ 1 Reply Last reply
                                  0
                                  • E elfring

                                    I hope that more software evolution can happen in this area so that the switching between discussed data models might become easier.

                                    JKSHJ Offline
                                    JKSHJ Offline
                                    JKSH
                                    Moderators
                                    wrote on last edited by JKSH
                                    #20

                                    @elfring said in Conversion of a SQL model into a standard item model?:

                                    I hope that more software evolution can happen in this area so that the switching between discussed data models might become easier.

                                    We will not perform this "software evolution" because we cannot see any good reason to provide additional conversion/switching between QSqlTableModel and QStandardItemModel. Furthermore, none of your posts above provide convincing arguments for this conversion/switching.

                                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                    E 1 Reply Last reply
                                    3
                                    • JKSHJ JKSH

                                      @elfring said in Conversion of a SQL model into a standard item model?:

                                      I hope that more software evolution can happen in this area so that the switching between discussed data models might become easier.

                                      We will not perform this "software evolution" because we cannot see any good reason to provide additional conversion/switching between QSqlTableModel and QStandardItemModel. Furthermore, none of your posts above provide convincing arguments for this conversion/switching.

                                      E Offline
                                      E Offline
                                      elfring
                                      wrote on last edited by
                                      #21

                                      Will other Qt users share more convincing arguments from involved software development challenges?

                                      JonBJ JKSHJ 2 Replies Last reply
                                      0
                                      • E elfring

                                        Will other Qt users share more convincing arguments from involved software development challenges?

                                        JonBJ Offline
                                        JonBJ Offline
                                        JonB
                                        wrote on last edited by
                                        #22

                                        @elfring

                                        Will other Qt users share more convincing arguments from involved software development challenges?

                                        "Other Qt users" will not even understand what these unending questions are about ;-) Just saying....

                                        E 1 Reply Last reply
                                        2
                                        • JonBJ JonB

                                          @elfring

                                          Will other Qt users share more convincing arguments from involved software development challenges?

                                          "Other Qt users" will not even understand what these unending questions are about ;-) Just saying....

                                          E Offline
                                          E Offline
                                          elfring
                                          wrote on last edited by
                                          #23

                                          I assume that some Qt users will care for collateral evolution around data models.

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved