DESCRIPTION.rst 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. SQLAlchemy
  2. ==========
  3. The Python SQL Toolkit and Object Relational Mapper
  4. Introduction
  5. -------------
  6. SQLAlchemy is the Python SQL toolkit and Object Relational Mapper
  7. that gives application developers the full power and
  8. flexibility of SQL. SQLAlchemy provides a full suite
  9. of well known enterprise-level persistence patterns,
  10. designed for efficient and high-performing database
  11. access, adapted into a simple and Pythonic domain
  12. language.
  13. Major SQLAlchemy features include:
  14. * An industrial strength ORM, built
  15. from the core on the identity map, unit of work,
  16. and data mapper patterns. These patterns
  17. allow transparent persistence of objects
  18. using a declarative configuration system.
  19. Domain models
  20. can be constructed and manipulated naturally,
  21. and changes are synchronized with the
  22. current transaction automatically.
  23. * A relationally-oriented query system, exposing
  24. the full range of SQL's capabilities
  25. explicitly, including joins, subqueries,
  26. correlation, and most everything else,
  27. in terms of the object model.
  28. Writing queries with the ORM uses the same
  29. techniques of relational composition you use
  30. when writing SQL. While you can drop into
  31. literal SQL at any time, it's virtually never
  32. needed.
  33. * A comprehensive and flexible system
  34. of eager loading for related collections and objects.
  35. Collections are cached within a session,
  36. and can be loaded on individual access, all
  37. at once using joins, or by query per collection
  38. across the full result set.
  39. * A Core SQL construction system and DBAPI
  40. interaction layer. The SQLAlchemy Core is
  41. separate from the ORM and is a full database
  42. abstraction layer in its own right, and includes
  43. an extensible Python-based SQL expression
  44. language, schema metadata, connection pooling,
  45. type coercion, and custom types.
  46. * All primary and foreign key constraints are
  47. assumed to be composite and natural. Surrogate
  48. integer primary keys are of course still the
  49. norm, but SQLAlchemy never assumes or hardcodes
  50. to this model.
  51. * Database introspection and generation. Database
  52. schemas can be "reflected" in one step into
  53. Python structures representing database metadata;
  54. those same structures can then generate
  55. CREATE statements right back out - all within
  56. the Core, independent of the ORM.
  57. SQLAlchemy's philosophy:
  58. * SQL databases behave less and less like object
  59. collections the more size and performance start to
  60. matter; object collections behave less and less like
  61. tables and rows the more abstraction starts to matter.
  62. SQLAlchemy aims to accommodate both of these
  63. principles.
  64. * An ORM doesn't need to hide the "R". A relational
  65. database provides rich, set-based functionality
  66. that should be fully exposed. SQLAlchemy's
  67. ORM provides an open-ended set of patterns
  68. that allow a developer to construct a custom
  69. mediation layer between a domain model and
  70. a relational schema, turning the so-called
  71. "object relational impedance" issue into
  72. a distant memory.
  73. * The developer, in all cases, makes all decisions
  74. regarding the design, structure, and naming conventions
  75. of both the object model as well as the relational
  76. schema. SQLAlchemy only provides the means
  77. to automate the execution of these decisions.
  78. * With SQLAlchemy, there's no such thing as
  79. "the ORM generated a bad query" - you
  80. retain full control over the structure of
  81. queries, including how joins are organized,
  82. how subqueries and correlation is used, what
  83. columns are requested. Everything SQLAlchemy
  84. does is ultimately the result of a developer-
  85. initiated decision.
  86. * Don't use an ORM if the problem doesn't need one.
  87. SQLAlchemy consists of a Core and separate ORM
  88. component. The Core offers a full SQL expression
  89. language that allows Pythonic construction
  90. of SQL constructs that render directly to SQL
  91. strings for a target database, returning
  92. result sets that are essentially enhanced DBAPI
  93. cursors.
  94. * Transactions should be the norm. With SQLAlchemy's
  95. ORM, nothing goes to permanent storage until
  96. commit() is called. SQLAlchemy encourages applications
  97. to create a consistent means of delineating
  98. the start and end of a series of operations.
  99. * Never render a literal value in a SQL statement.
  100. Bound parameters are used to the greatest degree
  101. possible, allowing query optimizers to cache
  102. query plans effectively and making SQL injection
  103. attacks a non-issue.
  104. Documentation
  105. -------------
  106. Latest documentation is at:
  107. http://www.sqlalchemy.org/docs/
  108. Installation / Requirements
  109. ---------------------------
  110. Full documentation for installation is at
  111. `Installation <http://www.sqlalchemy.org/docs/intro.html#installation>`_.
  112. Getting Help / Development / Bug reporting
  113. ------------------------------------------
  114. Please refer to the `SQLAlchemy Community Guide <http://www.sqlalchemy.org/support.html>`_.
  115. License
  116. -------
  117. SQLAlchemy is distributed under the `MIT license
  118. <http://www.opensource.org/licenses/mit-license.php>`_.