Re: django/Data Base Advice
On Jan 5, 6:40 pm, Petite Abeille wrote: > On Jan 6, 2012, at 12:13 AM, Chris Kavanagh wrote: > > > I believe, thanks to your (previous) post, I was confused as to the > > difference between SQL and Database in general. I had thought learning > > SQL was learning database design. When in actuality, it's just the > > language used to access databases. I need to study database concepts > > and design. > > There are two main aspects to SQL: Data Definition Language (DDL [1]) and > Data Manipulation Language (DML [2]). > > DDL is was you design database with (create table, etc). DML is what you > interact database with (select, update, etc). > > In the same way as it's rather helpful to understand HTTP itself to build a > web application, it's rather essential to understand database design if you > build a database, irrespectively of sugar coating (ORM [3], MVC, and other > TLA). > > Learn about normalization [3]. > > Take a look at SQLite to get started [4][5]. > > In the meantime: > > Double-thinking in > SQLhttp://explainextended.com/2009/07/12/double-thinking-in-sql/ > > Also:http://browsertoolkit.com/fault-tolerance.png > > [1]http://en.wikipedia.org/wiki/Data_Definition_Language > [2]http://en.wikipedia.org/wiki/Data_Manipulation_Language > [3]http://en.wikipedia.org/wiki/Database_normalization > [4]http://www.sqlite.org/ > [5]http://www.sqlite.org/lang.html Thank you for the advice Petite. I will check out those links also. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 6, 2012, at 12:13 AM, Chris Kavanagh wrote: > I believe, thanks to your (previous) post, I was confused as to the > difference between SQL and Database in general. I had thought learning > SQL was learning database design. When in actuality, it's just the > language used to access databases. I need to study database concepts > and design. There are two main aspects to SQL: Data Definition Language (DDL [1]) and Data Manipulation Language (DML [2]). DDL is was you design database with (create table, etc). DML is what you interact database with (select, update, etc). In the same way as it's rather helpful to understand HTTP itself to build a web application, it's rather essential to understand database design if you build a database, irrespectively of sugar coating (ORM [3], MVC, and other TLA). Learn about normalization [3]. Take a look at SQLite to get started [4][5]. In the meantime: Double-thinking in SQL http://explainextended.com/2009/07/12/double-thinking-in-sql/ Also: http://browsertoolkit.com/fault-tolerance.png [1] http://en.wikipedia.org/wiki/Data_Definition_Language [2] http://en.wikipedia.org/wiki/Data_Manipulation_Language [3] http://en.wikipedia.org/wiki/Database_normalization [4] http://www.sqlite.org/ [5] http://www.sqlite.org/lang.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 5, 2:54 pm, Lie Ryan wrote: > On 01/06/2012 02:35 AM, Dennis Lee Bieber wrote: > > > Django's models are just a means to define those independent of engine > > specific notation. > > while introducing django-specific notation, which generally maps more > neatly to the theoretical foundation than SQL (while SQL maps more > neatly to the implementation of database system). > > In particular, in django the concept of primary keys is implemented as > autoincrementing integers is well hidden from you, and django's foreign > keys is a full-fledged objects instead of integers with a few restrictions. I believe, thanks to your (previous) post, I was confused as to the difference between SQL and Database in general. I had thought learning SQL was learning database design. When in actuality, it's just the language used to access databases. I need to study database concepts and design. And I think that probably concludes my question to this post. While knowing SQL will be helpful, I believe I need to learn some about general database concepts. THANKS TO EVERYONE who helped me!!! It's very much appreciated, and I do mean that sincerely. Thanks for taking your time to help a novice. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 5, 10:35 am, Dennis Lee Bieber wrote: > On Wed, 4 Jan 2012 17:50:41 -0800 (PST), Chris Kavanagh > > While my comment regarding MVC has been shot down by others, I'll > still stand by the comment regarding relational database theory: the > first three Codd Normal Forms and related concepts. These are > independent of the actual database engine used in the end. Knowing what > to put into a relation (in formal theory, what folks commonly call a > "table" is the "relation" -- not the links from one table to another)... > Django's models are just a means to define those independent of engine > specific notation. > > SQL, originally (when it was IBM's Sequel), was a pure query > language sort of combining bits of relational algebra and relational > calculus. It was supposed to be usable even with hierarchical or network > database systems (though the backend code generator had to be fairly > complex, compared to simple flat-file systems which many relational > engines work as -- MySQL, dBase, Foxpro all use individual files for > each relation [table]). > > Knowing SQL in general can give some insights into what Django is > doing behind the scenes for the 1<>many and many<>many linkages. > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ After reading the posts concerning whether it's an MVC or MTV here's what the book says: "Django follows the MVC pattern closely enough that it CAN be called an MVC framework." I just thought I'd post that to be fair. . .Thanks Dennis. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 5, 3:58 am, Lie Ryan wrote: > On 01/05/2012 01:01 PM, Chris Kavanagh wrote: > > > While learning SQL could be helpful for writing fine-tuned SQL queries, > IMO it doesn't really help much to design an effective database. To > design an effective database schema, you need to learn about database, > not (just) SQL. Learn about basic database concept such as primary and > foreign keys, data modelling, and normalization (up to 3rd or 4th level > normalization is generally good enough for all practical purposes). Ok, I just learned something. I THOUGHT SQL WAS learning Database!!! So, SQL is really just the language used to interact with databases, not really the database itself??? I need to Google database concepts and learn that, not just SQL?? I assume that's what you're saying Lie. And THANKS for the advice. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On 01/06/2012 02:35 AM, Dennis Lee Bieber wrote: Django's models are just a means to define those independent of engine specific notation. while introducing django-specific notation, which generally maps more neatly to the theoretical foundation than SQL (while SQL maps more neatly to the implementation of database system). In particular, in django the concept of primary keys is implemented as autoincrementing integers is well hidden from you, and django's foreign keys is a full-fledged objects instead of integers with a few restrictions. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On 01/05/2012 01:01 PM, Chris Kavanagh wrote: On Jan 4, 8:20 am, Andre Terra wrote: I'm sorry, folks, but I'll have to *vehemently **disagree *with a lot of what has been said in this thread. To the OP, I'm sorry I didn't reply any sooner. No, you *don't need *to go reading about what MVC means. Django is a *MTV *framework, not *MVC*. There are similarities, but the differences are enough to confuse your head if this is your first time with either one. You should definitely stick to Django Book[1] for a definition on what Models, Views and Templates are. Everyone who says otherwise is wrong. Once you're comfortable with Django, feel free to explore other frameworks so you can weigh the pros and cons yourself. No, you *don't need* to read the Python PEP on DB-API (?!?!). I'll go as far as say you *shouldn't.* Not now and not for any time in the foreseeable feature. You won't need to write raw SQL in Django until you've reached a big bottleneck, and one that can't be solved in any other way. Writing raw SQL is exactly what Django wants you to *stop* doing. The ORM doesn't only exist in order to speed up development. It provides a layer of abstraction that also allows for easy refactoring and code improvement. SQL is not as flexible. The only PEP you need to read right away is PEP 8[2]. Learn it, love it, memorize it, use it. Everything else will only bring marginal benefits at such an early stage in the learning curve while also carrying a level of complexity that will most likely be a hindrance to your overall experience. Follow the tutorials and the django book (while outdated, most of it should work fine). When asking questions, remember to paste a *full *traceback and code examples. It might not make any sense to you, but eventually you'll learn your way around it. #django on freenode is rather helpful for quick questions and, if you know how to ask your question[3], this mailing list will also prove useful. Finally, If you need some pointers on HTML/CSS/JS, start with the HTML5 boilerplate[4] "framework". Everyone and their grandma seem to be using it nowadays. It will give you enough of a starting point that should make cross-browser compatibility as painless as possible, and should get you going in a flash. I hope you find my advice convincing enough so that it may prevent you from hurting your own learning process. I wish you only the best! Good luck and happy coding! André Terra [1]http://djangobook.com/en/2.0/chapter01/ [2]http://www.python.org/dev/peps/pep-0008/ [3]https://code.djangoproject.com/wiki/UsingTheMailingList [4]http://html5boilerplate.com/ Thanks for the advice Andre. . .Ok here's the crux of my original question, that I didn't ask very well. How can I learn to make my own Models, without knowing SQL?? In the book, at the beginning of Chp 5, Models, there's a note that says something like, "you don't strictly need to know SQL to follow along, but it sure helps." Since I have no database experience, I took that quote seriously. To be honest, after looking through the Models chapter in the book, and on djangoproject.com, it doesn't look too complicated. The Model Class Fields seem pretty simple. But then again, if I had to design a model from scratch, I think I would have a problem. That's why I thought learning SQL, just to learn a little about databases might be helpful. While learning SQL could be helpful for writing fine-tuned SQL queries, IMO it doesn't really help much to design an effective database. To design an effective database schema, you need to learn about database, not (just) SQL. Learn about basic database concept such as primary and foreign keys, data modelling, and normalization (up to 3rd or 4th level normalization is generally good enough for all practical purposes). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Wed, 2012-01-04 at 11:20 -0200, Andre Terra wrote: > I'm sorry, folks, but I'll have to vehemently disagree with a lot of > what has been said in this thread. To the OP, I'm sorry I didn't reply > any sooner. > > No, you don't need to go reading about what MVC means. Django is a MTV > framework, not MVC. There are similarities, but the differences are > enough to confuse your head if this is your first time with either > one. You should definitely stick to Django Book[1] for a definition on > what Models, Views and Templates are. Everyone who says otherwise is > wrong. Once you're comfortable with Django, feel free to explore other > frameworks so you can weigh the pros and cons yourself. > > No, you don't need to read the Python PEP on DB-API (?!?!). I'll go as > far as say you shouldn't. Not now and not for any time in the > foreseeable feature. You won't need to write raw SQL in Django until > you've reached a big bottleneck, and one that can't be solved in any > other way. Writing raw SQL is exactly what Django wants you to stop > doing. The ORM doesn't only exist in order to speed up development. It > provides a layer of abstraction that also allows for easy refactoring > and code improvement. SQL is not as flexible. > > The only PEP you need to read right away is PEP 8[2]. Learn it, love > it, memorize it, use it. Everything else will only bring marginal > benefits at such an early stage in the learning curve while also > carrying a level of complexity that will most likely be a hindrance to > your overall experience. > > Follow the tutorials and the django book (while outdated, most of it > should work fine). When asking questions, remember to paste a full > traceback and code examples. It might not make any sense to you, but > eventually you'll learn your way around it. #django on freenode is > rather helpful for quick questions and, if you know how to ask your > question[3], this mailing list will also prove useful. > > Finally, If you need some pointers on HTML/CSS/JS, start with the > HTML5 boilerplate[4] "framework". Everyone and their grandma seem to > be using it nowadays. It will give you enough of a starting point that > should make cross-browser compatibility as painless as possible, and > should get you going in a flash. > > I hope you find my advice convincing enough so that it may prevent you > from hurting your own learning process. I wish you only the best! > I fully agree - except for the caveat that reading up a bit on normal forms will not hurt. Django cannot design your db for you - you have to do it yourself. -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 4, 10:36 am, Javier Guerra Giraldez wrote: > On Wed, Jan 4, 2012 at 8:20 AM, Andre Terra wrote: > > No, you don't need to go reading about what MVC means. Django is a MTV > > framework, not MVC. There are similarities, but the differences are enough > > to confuse your head if this is your first time with either one. > > I agree, i'd even say forget about MVC! > > this is a pet peeve of mine, MVC was originally defined as a _modular_ > design for OOP GUI frameworks. There, for every complex user > interaction, you define three modules (usually a class each, but not > necessarily): the Model that keeps the immediate data in an > OOP-friendly way, the View that presents it using a GUI, and the > Controller, that receives events and modifies the data in the Model, > and (sometimes) tells the View to update or change modes. > > Code reuse gets enhanced, since you frequently can use the same view > for different parts of the program, and the same model might be > presented in different ways by different views. configurability also > becomes a desirable trait, that lets use the same view or model code > for different objects, just by creating differently-configured > instances. > > many years later, when the 'three-tier' web architecture (storage > layer, business intelligence layer and presentation layer) was > well-known and viewed by some as overly complex for 'dynamic' web > apps, the MVC acronym got reused, but now it's a _layered_ > architecture for web apps: there you design a model layer (that > presents storage with a nice API), a View layer (comprising of some > data-gathering logic and templates to generate HTML) and a Controller > layer that.. is anything else needed? well, lets say it handles > URLs. > > As you can see, web MVC is totally different from GUI MVC, and it's a > very ill-fitting description, since it's about layers and not modules, > and the controller is so loosely defined (especially when compared to > the crisp definitions in GUI MVC) that every framework defines it > differently and in many cases add unnecessary complexity instead of > removing it (some PHP frameworks are particularly guilty of this). > > the MTV architecture in Django is far cleaner, since it acknowledges > that there's no controller (the URL handling part is too simple to be > a layer), and makes very explicit the separation between > data-gathering (view functions/classes) and presentation (templates) > > -- > Javier Thank You Javier. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 4, 9:16 am, Venkatraman S wrote: > On Wed, Jan 4, 2012 at 6:50 PM, Andre Terra wrote: > > You won't need to write raw SQL in Django until you've reached a big > > bottleneck, and one that can't be solved in any other way. Writing raw SQL > > is exactly what Django wants you to *stop* doing. The ORM doesn't only > > exist in order to speed up development. It provides a layer of abstraction > > that also allows for easy refactoring and code improvement. SQL is not as > > flexible. > > I havent read the rest of the thread; but I agree with what you mentioned > in your reply, with suitable reservations on the above comment. > > SQL is highly flexible provided you know to write good sql (its like the > way Russell mentions 'It Depends' :P ); atleast i have been writing sqls > for the past 8 years and i find it easy to write them when the > relationships are complex. I come from a database family, and writing > highly database cohesive apps is what i have been doing for quiet sometime. > And it is very much given that, if you are writing a reporting app with > 30-40 tables, then you would end up writing raw sqls(this is NOT the norm > for a non-reporting app). > > But when i mention the above, i also see that django ORM produces some > really nice SQLs for mediocre usecases, i.e, i am yet to stumble on a case > wherein the SQL produced by the ORM wouldnt be the same(tuned) as what i > would write. So Kudos over there. In my spare time, i always mess around > with hierarchical queries and what not to see what the django-orm produces > and i must say that it has been a good learning experience. > > To cut verbiage/or to summarize...and...Not to confuse the OP : yes, as > Andre mentions, if you do not have any advance use cases; go ahead with > django orm. It wouldnt give you any sleepless nights. > > -Venkat Thanks for the advice Venkat. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 4, 8:20 am, Andre Terra wrote: > I'm sorry, folks, but I'll have to *vehemently **disagree *with a lot of > what has been said in this thread. To the OP, I'm sorry I didn't reply any > sooner. > > No, you *don't need *to go reading about what MVC means. Django is a > *MTV *framework, > not *MVC*. There are similarities, but the differences are enough to > confuse your head if this is your first time with either one. You should > definitely stick to Django Book[1] for a definition on what Models, Views > and Templates are. Everyone who says otherwise is wrong. Once you're > comfortable with Django, feel free to explore other frameworks so you can > weigh the pros and cons yourself. > > No, you *don't need* to read the Python PEP on DB-API (?!?!). I'll go as > far as say you *shouldn't.* Not now and not for any time in the foreseeable > feature. You won't need to write raw SQL in Django until you've reached a > big bottleneck, and one that can't be solved in any other way. Writing raw > SQL is exactly what Django wants you to *stop* doing. The ORM doesn't only > exist in order to speed up development. It provides a layer of abstraction > that also allows for easy refactoring and code improvement. SQL is not as > flexible. > > The only PEP you need to read right away is PEP 8[2]. Learn it, love it, > memorize it, use it. Everything else will only bring marginal benefits at > such an early stage in the learning curve while also carrying a level of > complexity that will most likely be a hindrance to your overall experience. > > Follow the tutorials and the django book (while outdated, most of it should > work fine). When asking questions, remember to paste a *full *traceback and > code examples. It might not make any sense to you, but eventually you'll > learn your way around it. #django on freenode is rather helpful for quick > questions and, if you know how to ask your question[3], this mailing list > will also prove useful. > > Finally, If you need some pointers on HTML/CSS/JS, start with the HTML5 > boilerplate[4] "framework". Everyone and their grandma seem to be using it > nowadays. It will give you enough of a starting point that should make > cross-browser compatibility as painless as possible, and should get you > going in a flash. > > I hope you find my advice convincing enough so that it may prevent you from > hurting your own learning process. I wish you only the best! > > Good luck and happy coding! > > André Terra > > [1]http://djangobook.com/en/2.0/chapter01/ > [2]http://www.python.org/dev/peps/pep-0008/ > [3]https://code.djangoproject.com/wiki/UsingTheMailingList > [4]http://html5boilerplate.com/ > Thanks for the advice Andre. . .Ok here's the crux of my original question, that I didn't ask very well. How can I learn to make my own Models, without knowing SQL?? In the book, at the beginning of Chp 5, Models, there's a note that says something like, "you don't strictly need to know SQL to follow along, but it sure helps." Since I have no database experience, I took that quote seriously. To be honest, after looking through the Models chapter in the book, and on djangoproject.com, it doesn't look too complicated. The Model Class Fields seem pretty simple. But then again, if I had to design a model from scratch, I think I would have a problem. That's why I thought learning SQL, just to learn a little about databases might be helpful. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 3, 11:40 pm, Dennis Lee Bieber wrote: > On Tue, 3 Jan 2012 19:30:37 -0800 (PST), Chris Kavanagh > > wrote: > > >Well, I was referring to the database part, but really I need to learn > >more about web development too. I know HTML, CSS, JavaScript vaguely, > >and that's about it. Since I LUV Python (like I said, a beginner in > >Python) I figured Django would be a good place to start learning web > >dev.Am I wrong?? You're saying INSTEAD OF Django, learn an MVC? I was > >under the impression Django was an MVC, am I wrong?? > > I think the advice was to learn MVC /as concepts/ (or theory), NOT > as a particular implementation. Once you understand how MVC separates > the parts of an application then you can examine how Django implements > MVC. > > I'd add the same comment with regards to database -- don't learn "A" > relational database system, but instead learn the concepts of relational > databases (which means learning at least the first three Codd Normal > Forms ). Then add SQL in general (inner/left/right joins, sorting, > etc.). > > Then, if you need it (you intend raw SQL access rather than using an > object-relational manager (ORM -- SQLAlchemy, for example), study the > Python PEP that discusses the DB-API, since many of the basic database > adapters implement that interface (at this point you may need to learn > the specifics of the database adapter you are using: MySQLdb uses %s for > positional placeholder, whereas SQLite3 uses ?). > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ Thanks for the advice Dennis! BTW, any relation to Justin??? Sorry, couldn't resist!!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Wed, Jan 4, 2012 at 8:20 AM, Andre Terra wrote: > No, you don't need to go reading about what MVC means. Django is a MTV > framework, not MVC. There are similarities, but the differences are enough > to confuse your head if this is your first time with either one. I agree, i'd even say forget about MVC! this is a pet peeve of mine, MVC was originally defined as a _modular_ design for OOP GUI frameworks. There, for every complex user interaction, you define three modules (usually a class each, but not necessarily): the Model that keeps the immediate data in an OOP-friendly way, the View that presents it using a GUI, and the Controller, that receives events and modifies the data in the Model, and (sometimes) tells the View to update or change modes. Code reuse gets enhanced, since you frequently can use the same view for different parts of the program, and the same model might be presented in different ways by different views. configurability also becomes a desirable trait, that lets use the same view or model code for different objects, just by creating differently-configured instances. many years later, when the 'three-tier' web architecture (storage layer, business intelligence layer and presentation layer) was well-known and viewed by some as overly complex for 'dynamic' web apps, the MVC acronym got reused, but now it's a _layered_ architecture for web apps: there you design a model layer (that presents storage with a nice API), a View layer (comprising of some data-gathering logic and templates to generate HTML) and a Controller layer that.. is anything else needed? well, lets say it handles URLs. As you can see, web MVC is totally different from GUI MVC, and it's a very ill-fitting description, since it's about layers and not modules, and the controller is so loosely defined (especially when compared to the crisp definitions in GUI MVC) that every framework defines it differently and in many cases add unnecessary complexity instead of removing it (some PHP frameworks are particularly guilty of this). the MTV architecture in Django is far cleaner, since it acknowledges that there's no controller (the URL handling part is too simple to be a layer), and makes very explicit the separation between data-gathering (view functions/classes) and presentation (templates) -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django/Data Base Advice
On Wed, Jan 4, 2012 at 12:16 PM, Venkatraman S wrote: > SQL is highly flexible provided you know to write good sql (its like the > way Russell mentions 'It Depends' :P ); atleast i have been writing sqls > for the past 8 years and i find it easy to write them when the > relationships are complex. I come from a database family, and writing > highly database cohesive apps is what i have been doing for quiet sometime. > And it is very much given that, if you are writing a reporting app with > 30-40 tables, then you would end up writing raw sqls(this is NOT the norm > for a non-reporting app). You, sir, are correct. SQL is a powerful tool, and one that must indeed be used if we are to write enterprise-grade applications. I should have probably picked a better word than "flexible". In reality, SQL's great flexibility is precisely what enables the creation of tools like the ORM. With enough time and knowledge, you can use SQL to slice your data in any way you can imagine, as long as we're talking about relational information. What I meant to emphasize is that hard coding your queries in python strings will most likely mean they will break as soon as you do some refactoring, schema migration and many other possible changes in your database. This is why raw SQL, while incredibly powerful, can be skipped in most everyday cases, especially for a beginner. The ORM allows for a good deal of tweaking that can be used to speed up the most common kinds of queries. That said, learning SQL is a fundamental step in becoming a "full-fledged" Django developer, as dealing with databases will your everyday task. It is also the only way you will understand what's happening "behind the curtains". It is a necessary step in building scalable apps and keeping them as light as possible. TL;DR I shouldn't have said SQL isn't flexible; the lack of flexibility lies in hard coded strings, but that can even impact the python side of a Django app. Cheers, AT -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Wed, Jan 4, 2012 at 6:50 PM, Andre Terra wrote: > You won't need to write raw SQL in Django until you've reached a big > bottleneck, and one that can't be solved in any other way. Writing raw SQL > is exactly what Django wants you to *stop* doing. The ORM doesn't only > exist in order to speed up development. It provides a layer of abstraction > that also allows for easy refactoring and code improvement. SQL is not as > flexible. > I havent read the rest of the thread; but I agree with what you mentioned in your reply, with suitable reservations on the above comment. SQL is highly flexible provided you know to write good sql (its like the way Russell mentions 'It Depends' :P ); atleast i have been writing sqls for the past 8 years and i find it easy to write them when the relationships are complex. I come from a database family, and writing highly database cohesive apps is what i have been doing for quiet sometime. And it is very much given that, if you are writing a reporting app with 30-40 tables, then you would end up writing raw sqls(this is NOT the norm for a non-reporting app). But when i mention the above, i also see that django ORM produces some really nice SQLs for mediocre usecases, i.e, i am yet to stumble on a case wherein the SQL produced by the ORM wouldnt be the same(tuned) as what i would write. So Kudos over there. In my spare time, i always mess around with hierarchical queries and what not to see what the django-orm produces and i must say that it has been a good learning experience. To cut verbiage/or to summarize...and...Not to confuse the OP : yes, as Andre mentions, if you do not have any advance use cases; go ahead with django orm. It wouldnt give you any sleepless nights. -Venkat -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
I'm sorry, folks, but I'll have to *vehemently **disagree *with a lot of what has been said in this thread. To the OP, I'm sorry I didn't reply any sooner. No, you *don't need *to go reading about what MVC means. Django is a *MTV *framework, not *MVC*. There are similarities, but the differences are enough to confuse your head if this is your first time with either one. You should definitely stick to Django Book[1] for a definition on what Models, Views and Templates are. Everyone who says otherwise is wrong. Once you're comfortable with Django, feel free to explore other frameworks so you can weigh the pros and cons yourself. No, you *don't need* to read the Python PEP on DB-API (?!?!). I'll go as far as say you *shouldn't.* Not now and not for any time in the foreseeable feature. You won't need to write raw SQL in Django until you've reached a big bottleneck, and one that can't be solved in any other way. Writing raw SQL is exactly what Django wants you to *stop* doing. The ORM doesn't only exist in order to speed up development. It provides a layer of abstraction that also allows for easy refactoring and code improvement. SQL is not as flexible. The only PEP you need to read right away is PEP 8[2]. Learn it, love it, memorize it, use it. Everything else will only bring marginal benefits at such an early stage in the learning curve while also carrying a level of complexity that will most likely be a hindrance to your overall experience. Follow the tutorials and the django book (while outdated, most of it should work fine). When asking questions, remember to paste a *full *traceback and code examples. It might not make any sense to you, but eventually you'll learn your way around it. #django on freenode is rather helpful for quick questions and, if you know how to ask your question[3], this mailing list will also prove useful. Finally, If you need some pointers on HTML/CSS/JS, start with the HTML5 boilerplate[4] "framework". Everyone and their grandma seem to be using it nowadays. It will give you enough of a starting point that should make cross-browser compatibility as painless as possible, and should get you going in a flash. I hope you find my advice convincing enough so that it may prevent you from hurting your own learning process. I wish you only the best! Good luck and happy coding! André Terra [1] http://djangobook.com/en/2.0/chapter01/ [2] http://www.python.org/dev/peps/pep-0008/ [3] https://code.djangoproject.com/wiki/UsingTheMailingList [4] http://html5boilerplate.com/ On Wed, Jan 4, 2012 at 2:40 AM, Dennis Lee Bieber wrote: > On Tue, 3 Jan 2012 19:30:37 -0800 (PST), Chris Kavanagh > wrote: > > > > >Well, I was referring to the database part, but really I need to learn > >more about web development too. I know HTML, CSS, JavaScript vaguely, > >and that's about it. Since I LUV Python (like I said, a beginner in > >Python) I figured Django would be a good place to start learning web > >dev.Am I wrong?? You're saying INSTEAD OF Django, learn an MVC? I was > >under the impression Django was an MVC, am I wrong?? > > > I think the advice was to learn MVC /as concepts/ (or theory), NOT > as a particular implementation. Once you understand how MVC separates > the parts of an application then you can examine how Django implements > MVC. > >I'd add the same comment with regards to database -- don't learn "A" > relational database system, but instead learn the concepts of relational > databases (which means learning at least the first three Codd Normal > Forms ). Then add SQL in general (inner/left/right joins, sorting, > etc.). > >Then, if you need it (you intend raw SQL access rather than using an > object-relational manager (ORM -- SQLAlchemy, for example), study the > Python PEP that discusses the DB-API, since many of the basic database > adapters implement that interface (at this point you may need to learn > the specifics of the database adapter you are using: MySQLdb uses %s for > positional placeholder, whereas SQLite3 uses ?). > > -- >Wulfraed Dennis Lee Bieber AF6VN >wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 3, 5:58 pm, Python_Junkie wrote: > Don't want to confuse you on the database topic, but thought I would > add my 2 cents. > > You asked how to go about learning how to design / utilize the > database within the context of django. > > I just wanted to point out that the django tutorial will point you > down the road of implementing a database abstraction layer, the ORM. > With the object relational model (ORM), you can create tables and > relationships and extract or insert/update data from those tables. > > The ORM is fine to work with, however, just be aware that reading up > on database tutorials, sql queries, table design, relational models > etc, > may confuse you a bit when trying to equate those concepts to the ORM. > > My own preference is to use sql calls using python directly rather > than using the ORM in django. Just another (abstraction) layer to > learn, and it is a matter > of opinion the value it adds to the speed, or efficiency of the > development process > > On Jan 3, 4:09 am, wC wrote: > > > Thank you for the advice! Now when you say the ORM, are we talking about the > API for my particular database?? Interacting with it using SQL commands > within the API?? Forgive my ignorance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 3, 4:09 am, wC wrote: > Chris, > > I think was somehow in the same stage not so long ago... Here is how I went > about it: > > 1. I watched a db-class video from time to time (teaches you what joins are > etcetera). Using the ORM without db knowledge is ok if efficiency is not > your main concern. Sooner or later you have to make database design choices > and only relying on the community is going to slow you down. Good advice is > expensive (time or effort). > 2. Having read the docs on djangoproject.com (which are huge), I read > djangobook.com, then I started building my own apps following some of the > tutorials fromhttps://code.djangoproject.com/wiki/Tutorials. I made myself > a todo-app, for instance. There are about three or four tutorials for that > and each of them adds some knowledge (the nettuts one is for true > beginners). If you work on you app a bit you'll gain knowledge in testing, > migrating, implementing design and much more. I always asked myself 'does > my program solve a problem'. If it does not, you will get lost pretty > quickly. > 3. ? > > Not sure what the next step would be? Deploy a small website? Use third > party OS code? Any suggestions? > > Cheers > wC Thanks man, I will follow your advice! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 2, 8:49 pm, Victor Hooi wrote: > Hi, > > Do you mean learning more about Django in general, or about the > models.py/database portion specifically? > > If you haven't done much web-development before, or used any MVC > frameworks, I suggest you start by reading up on those - there's plenty of > guides to that online. > > In terms of learning database theory, I'd suggest either "Database Design > for Mere Mortals" > (http://www.amazon.com/Database-Design-Mere-Mortals-Hands/dp/0201694719), > or "Database Design with UML and SQL" (http://www.tomjewett.com/dbdesign/). > > Cheers, > Victor Well, I was referring to the database part, but really I need to learn more about web development too. I know HTML, CSS, JavaScript vaguely, and that's about it. Since I LUV Python (like I said, a beginner in Python) I figured Django would be a good place to start learning web dev.Am I wrong?? You're saying INSTEAD OF Django, learn an MVC? I was under the impression Django was an MVC, am I wrong?? And Thanks for the help Victor! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 2, 7:38 pm, Mike Dewhirst wrote: > On 3/01/2012 10:59am, Chris Kavanagh wrote: > > > > > > > > > > > > > On Jan 2, 6:57 pm, Chris Kavanagh wrote: > >> I'm new to django& programming in general. I know the basics of > >> Python. Anyways, going through the djangoproject tutorial, I came to > >> the part where you edit the polls/models.py, and this is where I need > >> advice. > > >> I understand roughly what's going in when we write the script in > >> models.py, however if I had to create something like this on my own, I > >> wouldn't know where to begin. Obviously I have no .db experience, but > >> I get the gist of the different types of fields django uses. The > >> question is, how do I go about learning this?? Do I need to go through > >> an SQL tutorial to better understand how this works?? > > >> Thanks in advance for ANY help! > > I read somewhere that it takes about 10,000 hours of > (learning/training/practice/work) to achieve mastery in any area > requiring complex skills and knowhow. Playing a musical instrument, > writing complex database systems for the web, air traffic control - you > name it. > > I think you need to bite the bullet and slog your way through the > tutorial. Don't expect to understand too much the first time but learn > to follow the written instructions *slavishly* until it actually works. > > Then get yourself a copy of The Definitive Guide to Django by Adrian > Holovaty and Jacob Kaplan-Moss and work through that. > > Finally tackle a small project of your own and make that work. Google > will help you answer most of your questions. > > Good luck > > Mike > > Thanks so much for the advice Mike. Actually I have the book, and I'm going through the tutorial now. When I came to the database part, I realized I didn't know a thing about them. So how could I write Python code that would interact with a database?? So, I figured there had to be someway to learn this stuff. I wasn't sure what to study to learn/ get better at it. . .After going through that chp in the book, and looking quickly at an SQL Tutorial, I think I have a better understanding of what I need to do. Again, thanks so much for the advice. It's much appreciated! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
Don't want to confuse you on the database topic, but thought I would add my 2 cents. You asked how to go about learning how to design / utilize the database within the context of django. I just wanted to point out that the django tutorial will point you down the road of implementing a database abstraction layer, the ORM. With the object relational model (ORM), you can create tables and relationships and extract or insert/update data from those tables. The ORM is fine to work with, however, just be aware that reading up on database tutorials, sql queries, table design, relational models etc, may confuse you a bit when trying to equate those concepts to the ORM. My own preference is to use sql calls using python directly rather than using the ORM in django. Just another (abstraction) layer to learn, and it is a matter of opinion the value it adds to the speed, or efficiency of the development process On Jan 3, 4:09 am, wC wrote: > Chris, > > I think was somehow in the same stage not so long ago... Here is how I went > about it: > > 1. I watched a db-class video from time to time (teaches you what joins are > etcetera). Using the ORM without db knowledge is ok if efficiency is not > your main concern. Sooner or later you have to make database design choices > and only relying on the community is going to slow you down. Good advice is > expensive (time or effort). > 2. Having read the docs on djangoproject.com (which are huge), I read > djangobook.com, then I started building my own apps following some of the > tutorials fromhttps://code.djangoproject.com/wiki/Tutorials. I made myself > a todo-app, for instance. There are about three or four tutorials for that > and each of them adds some knowledge (the nettuts one is for true > beginners). If you work on you app a bit you'll gain knowledge in testing, > migrating, implementing design and much more. I always asked myself 'does > my program solve a problem'. If it does not, you will get lost pretty > quickly. > 3. ? > > Not sure what the next step would be? Deploy a small website? Use third > party OS code? Any suggestions? > > Cheers > wC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
Chris, I think was somehow in the same stage not so long ago... Here is how I went about it: 1. I watched a db-class video from time to time (teaches you what joins are etcetera). Using the ORM without db knowledge is ok if efficiency is not your main concern. Sooner or later you have to make database design choices and only relying on the community is going to slow you down. Good advice is expensive (time or effort). 2. Having read the docs on djangoproject.com (which are huge), I read djangobook.com, then I started building my own apps following some of the tutorials from https://code.djangoproject.com/wiki/Tutorials. I made myself a todo-app, for instance. There are about three or four tutorials for that and each of them adds some knowledge (the nettuts one is for true beginners). If you work on you app a bit you'll gain knowledge in testing, migrating, implementing design and much more. I always asked myself 'does my program solve a problem'. If it does not, you will get lost pretty quickly. 3. ? Not sure what the next step would be? Deploy a small website? Use third party OS code? Any suggestions? Cheers wC -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/GBXHWYTcLqwJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
Hi, Do you mean learning more about Django in general, or about the models.py/database portion specifically? If you haven't done much web-development before, or used any MVC frameworks, I suggest you start by reading up on those - there's plenty of guides to that online. In terms of learning database theory, I'd suggest either "Database Design for Mere Mortals" (http://www.amazon.com/Database-Design-Mere-Mortals-Hands/dp/0201694719), or "Database Design with UML and SQL" (http://www.tomjewett.com/dbdesign/). Cheers, Victor -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kGmkW-Gk7I8J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On 3/01/2012 10:59am, Chris Kavanagh wrote: On Jan 2, 6:57 pm, Chris Kavanagh wrote: I'm new to django& programming in general. I know the basics of Python. Anyways, going through the djangoproject tutorial, I came to the part where you edit the polls/models.py, and this is where I need advice. I understand roughly what's going in when we write the script in models.py, however if I had to create something like this on my own, I wouldn't know where to begin. Obviously I have no .db experience, but I get the gist of the different types of fields django uses. The question is, how do I go about learning this?? Do I need to go through an SQL tutorial to better understand how this works?? Thanks in advance for ANY help! I read somewhere that it takes about 10,000 hours of (learning/training/practice/work) to achieve mastery in any area requiring complex skills and knowhow. Playing a musical instrument, writing complex database systems for the web, air traffic control - you name it. I think you need to bite the bullet and slog your way through the tutorial. Don't expect to understand too much the first time but learn to follow the written instructions *slavishly* until it actually works. Then get yourself a copy of The Definitive Guide to Django by Adrian Holovaty and Jacob Kaplan-Moss and work through that. Finally tackle a small project of your own and make that work. Google will help you answer most of your questions. Good luck Mike BTW, I'm using Winxp, django1.3.1 and Sqlite3 (with Python2.7) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django/Data Base Advice
On Jan 2, 6:57 pm, Chris Kavanagh wrote: > I'm new to django & programming in general. I know the basics of > Python. Anyways, going through the djangoproject tutorial, I came to > the part where you edit the polls/models.py, and this is where I need > advice. > > I understand roughly what's going in when we write the script in > models.py, however if I had to create something like this on my own, I > wouldn't know where to begin. Obviously I have no .db experience, but > I get the gist of the different types of fields django uses. The > question is, how do I go about learning this?? Do I need to go through > an SQL tutorial to better understand how this works?? > > Thanks in advance for ANY help! BTW, I'm using Winxp, django1.3.1 and Sqlite3 (with Python2.7) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.