tools to code generate python from existing database?









up vote
2
down vote

favorite












Please forgive my ignorance I am new to Python development.



Is there a tool to create Python code from an existing database (e.g. mySQL, Postgresql)



For example, if I have a database designed with sample data inside (I have tables, functions, and data established in a database) is there any code generator tools that will help me to generate some of the python code (e.g. classes/entities, etc.)










share|improve this question

























    up vote
    2
    down vote

    favorite












    Please forgive my ignorance I am new to Python development.



    Is there a tool to create Python code from an existing database (e.g. mySQL, Postgresql)



    For example, if I have a database designed with sample data inside (I have tables, functions, and data established in a database) is there any code generator tools that will help me to generate some of the python code (e.g. classes/entities, etc.)










    share|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      Please forgive my ignorance I am new to Python development.



      Is there a tool to create Python code from an existing database (e.g. mySQL, Postgresql)



      For example, if I have a database designed with sample data inside (I have tables, functions, and data established in a database) is there any code generator tools that will help me to generate some of the python code (e.g. classes/entities, etc.)










      share|improve this question













      Please forgive my ignorance I am new to Python development.



      Is there a tool to create Python code from an existing database (e.g. mySQL, Postgresql)



      For example, if I have a database designed with sample data inside (I have tables, functions, and data established in a database) is there any code generator tools that will help me to generate some of the python code (e.g. classes/entities, etc.)







      python mysql postgresql code-generation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 '11 at 21:02









      Skyguard

      633613




      633613






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          It sounds like you are describing Object-relational mapping (ORM). One popular ORM for Python is SQLAlchemy.






          share|improve this answer




















          • SQLAlchemy is built into pyramid correct? I haven't used it, but I thought SQLAlchemy takes the classes/entities and makes the database tables... so that would be the opposite of what I need it to do.. but I am not familiar with SQLAlchemy... is this the case?
            – Skyguard
            Nov 10 '11 at 0:32






          • 2




            Actually, SQLAlchemy can swing both ways. See blog.pythonlibrary.org/2010/09/10/….
            – Steven Rumbalski
            Nov 10 '11 at 2:25










          • Downvoter, why?
            – Steven Rumbalski
            Oct 26 '12 at 5:47

















          up vote
          0
          down vote













          To generate object relational mapper (ORM) models from a pre-existing SQL database, a tool that you may find useful is the Python module sqlacodegen or forked flask-sqlacodegen



          These will allow you to build a map of the database on your local disk, to be used with SQLAlchemy and/or Flask.



          I have posted here as I stumbled across your question whilst I was looking for these modules.






          share|improve this answer




















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            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',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2fstackoverflow.com%2fquestions%2f8071632%2ftools-to-code-generate-python-from-existing-database%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            It sounds like you are describing Object-relational mapping (ORM). One popular ORM for Python is SQLAlchemy.






            share|improve this answer




















            • SQLAlchemy is built into pyramid correct? I haven't used it, but I thought SQLAlchemy takes the classes/entities and makes the database tables... so that would be the opposite of what I need it to do.. but I am not familiar with SQLAlchemy... is this the case?
              – Skyguard
              Nov 10 '11 at 0:32






            • 2




              Actually, SQLAlchemy can swing both ways. See blog.pythonlibrary.org/2010/09/10/….
              – Steven Rumbalski
              Nov 10 '11 at 2:25










            • Downvoter, why?
              – Steven Rumbalski
              Oct 26 '12 at 5:47














            up vote
            2
            down vote



            accepted










            It sounds like you are describing Object-relational mapping (ORM). One popular ORM for Python is SQLAlchemy.






            share|improve this answer




















            • SQLAlchemy is built into pyramid correct? I haven't used it, but I thought SQLAlchemy takes the classes/entities and makes the database tables... so that would be the opposite of what I need it to do.. but I am not familiar with SQLAlchemy... is this the case?
              – Skyguard
              Nov 10 '11 at 0:32






            • 2




              Actually, SQLAlchemy can swing both ways. See blog.pythonlibrary.org/2010/09/10/….
              – Steven Rumbalski
              Nov 10 '11 at 2:25










            • Downvoter, why?
              – Steven Rumbalski
              Oct 26 '12 at 5:47












            up vote
            2
            down vote



            accepted







            up vote
            2
            down vote



            accepted






            It sounds like you are describing Object-relational mapping (ORM). One popular ORM for Python is SQLAlchemy.






            share|improve this answer












            It sounds like you are describing Object-relational mapping (ORM). One popular ORM for Python is SQLAlchemy.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 9 '11 at 21:07









            Steven Rumbalski

            32.9k65892




            32.9k65892











            • SQLAlchemy is built into pyramid correct? I haven't used it, but I thought SQLAlchemy takes the classes/entities and makes the database tables... so that would be the opposite of what I need it to do.. but I am not familiar with SQLAlchemy... is this the case?
              – Skyguard
              Nov 10 '11 at 0:32






            • 2




              Actually, SQLAlchemy can swing both ways. See blog.pythonlibrary.org/2010/09/10/….
              – Steven Rumbalski
              Nov 10 '11 at 2:25










            • Downvoter, why?
              – Steven Rumbalski
              Oct 26 '12 at 5:47
















            • SQLAlchemy is built into pyramid correct? I haven't used it, but I thought SQLAlchemy takes the classes/entities and makes the database tables... so that would be the opposite of what I need it to do.. but I am not familiar with SQLAlchemy... is this the case?
              – Skyguard
              Nov 10 '11 at 0:32






            • 2




              Actually, SQLAlchemy can swing both ways. See blog.pythonlibrary.org/2010/09/10/….
              – Steven Rumbalski
              Nov 10 '11 at 2:25










            • Downvoter, why?
              – Steven Rumbalski
              Oct 26 '12 at 5:47















            SQLAlchemy is built into pyramid correct? I haven't used it, but I thought SQLAlchemy takes the classes/entities and makes the database tables... so that would be the opposite of what I need it to do.. but I am not familiar with SQLAlchemy... is this the case?
            – Skyguard
            Nov 10 '11 at 0:32




            SQLAlchemy is built into pyramid correct? I haven't used it, but I thought SQLAlchemy takes the classes/entities and makes the database tables... so that would be the opposite of what I need it to do.. but I am not familiar with SQLAlchemy... is this the case?
            – Skyguard
            Nov 10 '11 at 0:32




            2




            2




            Actually, SQLAlchemy can swing both ways. See blog.pythonlibrary.org/2010/09/10/….
            – Steven Rumbalski
            Nov 10 '11 at 2:25




            Actually, SQLAlchemy can swing both ways. See blog.pythonlibrary.org/2010/09/10/….
            – Steven Rumbalski
            Nov 10 '11 at 2:25












            Downvoter, why?
            – Steven Rumbalski
            Oct 26 '12 at 5:47




            Downvoter, why?
            – Steven Rumbalski
            Oct 26 '12 at 5:47












            up vote
            0
            down vote













            To generate object relational mapper (ORM) models from a pre-existing SQL database, a tool that you may find useful is the Python module sqlacodegen or forked flask-sqlacodegen



            These will allow you to build a map of the database on your local disk, to be used with SQLAlchemy and/or Flask.



            I have posted here as I stumbled across your question whilst I was looking for these modules.






            share|improve this answer
























              up vote
              0
              down vote













              To generate object relational mapper (ORM) models from a pre-existing SQL database, a tool that you may find useful is the Python module sqlacodegen or forked flask-sqlacodegen



              These will allow you to build a map of the database on your local disk, to be used with SQLAlchemy and/or Flask.



              I have posted here as I stumbled across your question whilst I was looking for these modules.






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                To generate object relational mapper (ORM) models from a pre-existing SQL database, a tool that you may find useful is the Python module sqlacodegen or forked flask-sqlacodegen



                These will allow you to build a map of the database on your local disk, to be used with SQLAlchemy and/or Flask.



                I have posted here as I stumbled across your question whilst I was looking for these modules.






                share|improve this answer












                To generate object relational mapper (ORM) models from a pre-existing SQL database, a tool that you may find useful is the Python module sqlacodegen or forked flask-sqlacodegen



                These will allow you to build a map of the database on your local disk, to be used with SQLAlchemy and/or Flask.



                I have posted here as I stumbled across your question whilst I was looking for these modules.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 10 at 20:17









                Mark

                548




                548



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f8071632%2ftools-to-code-generate-python-from-existing-database%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

                    Top Tejano songwriter Luis Silva dead of heart attack at 64

                    政党

                    天津地下鉄3号線