Object Relational Tutorial 对象关系教程
The SQLAlchemy Object Relational Mapper presents a method of associating user-defined Python classes with database tables, and instances of those classes (objects) with rows in their corresponding tables. It includes a system that transparently synchronizes all changes in state between objects and their related rows, called a unit of work, as well as a system for expressing database queries in terms of the user defined classes and their defined relationships between each other.
The ORM is in contrast to the SQLAlchemy Expression Language, upon which the ORM is constructed. Whereas the SQL Expression Language, introduced in SQL Expression Language Tutorial, presents a system of representing the primitive constructs of the relational database directly without opinion, the ORM presents a high level and abstracted pattern of usage, which itself is an example of applied usage of the Expression Language.
While there is overlap among the usage patterns of the ORM and the Expression Language, the similarities are more superficial than they may at first appear. One approaches the structure and content of data from the perspective of a user-defined domain model which is transparently persisted and refreshed from its underlying storage model. The other approaches it from the perspective of literal schema and SQL expression representations which are explicitly composed into messages consumed individually by the database.
A successful application may be constructed using the Object Relational Mapper exclusively. In advanced situations, an application constructed with the ORM may make occasional usage of the Expression Language directly in certain areas where specific database interactions are required.
The following tutorial is in doctest format, meaning each >>> line represents something you can type at a Python command prompt, and the following text represents the expected return value.
SQLAlchemy对象关系映射器提供了一种将用户定义的Python类与数据库表相关联的方法,以及在对应表中具有行的那些类(对象)的实例。它包括一个系统,可以透明地同步对象与其相关行之间的状态的所有更改,称为工作单元,以及根据用户定义的类及其彼此之间定义的关系来表达数据库查询的系统。
ORM与构建ORM的SQLAlchemy表达式语言形成对比。而在SQL表达语言教程中引入的SQL表达式语言提供了一种直接表示关系数据库的原始构造的系统,而ORM呈现出高级和抽象的使用模式,本身就是应用程序的使用示例表达语言。
虽然ORM和表达语言的使用模式之间存在重叠,但是相似之处比起初显示的更为肤浅。从用户定义的域模型的角度来看,数据的结构和内容从透明地持久化并从其底层存储模型刷新。另一个从文字模式和SQL表达式表达的角度来看待,这些表达式被明确地组合成数据库单独消费的消息。
可以使用对象关系映射器专门构建成功的应用程序。在高级情况下,使用ORM构建的应用程序可能会在需要特定数据库交互的某些区域中偶尔使用表达式语言。
以下教程采用doctest格式,这意味着每行>>>行表示可以在Python命令提示符下键入的内容,下面的文本表示预期的返回值。
http://docs.sqlalchemy.org/en/latest/orm/tutorial.html
Object Relational Tutorial 对象关系教程的更多相关文章
- Object/Relational Mapping 数学关系 反面向对象
[hibernate ORM 是对象关系映射框架 事实上的持久化存储引擎] http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/ ...
- ORM详解,ORM Object relation mapping (对象关系映射)
- Object Relational Mapping框架之Hibernate
hibernate框架简介: hibernate框架就是开发中在持久层中应用居多的ORM框架,它对JDBC做了轻量级的封装. (百度介绍,感觉不错) 什么是ORM:Object Relational ...
- Flask-SQLAlchemy 配置,处理对象-关系,一对多,多对多
ORM(Object Relational Mapper) 对象关系映射.指将面对对象得方法映射到数据库中的关系对象中. Flask-SQLAlchemy是一个Flask扩展,能够支持多种数据库后 ...
- c++对象关系映射(ORM)框架
ORM(Object Relational Mapping, 对象关系映射),用来将基于对象的数据结构映射到SQL的数据结构中,即将基于对象的数据映射到关系表中的字段,然后我们可以通过对象提供的接口来 ...
- SQLAlchemy-对象关系教程ORM-连接,子查询
对象关系教程ORM-连接 一:内连接 方法一: for u, a in session.query(User, Address).\ filter(User.id==Address.user_id). ...
- SQLAlchemy-对象关系教程ORM-query
一:对象关系教程查询 一个 Query创建对象时使用 Session的query()方法 .此函数接受一个变量数量的参数,可以是任何类和class-instrumented描述符的组合. Query返 ...
- 一:ORM关系对象映射(Object Relational Mapping,简称ORM)
狼来的日子里! 奋发博取 10)django-ORM(创建,字段类型,字段参数) 一:ORM关系对象映射(Object Relational Mapping,简称ORM) ORM分两种: DB fir ...
- 解析大型.NET ERP系统数据访问 对象关系映射框架LLBL Gen Pro
LLBL Gen Pro是一个为.NET开发人员设计的的对象关系映射(ORM)框架,与NHibernate,Entity Framework等框架一样,通过实体与数据表的映射,实现关系数据库持久化. ...
随机推荐
- 用phpcms切换中英文网页的方法(不用解析二级域名)、phpcms完成pc和手机端切换(同一域名)
AA.phpcms进行双语切换方法(不用解析二级域名)作者:悦悦 博客地址:http://www.cnblogs.com/nuanai/ phpcms进行两种语言的切换,有一把部分的人都是进行的二级域 ...
- 码农、黑客和2B程序员之间的区别
码农: 黑客: 2B程序员: 求2的32次方: 码农: System.out.println(Math.pow(2, 32)); 黑客: System.out.println(1L<<32 ...
- python端口扫描用多线程+线程安全的队列+Thread类实现
用线程安全的队列Queue实现扫描端口数据存储 用多线程扫描端口 用Thread类实现程序组织 #coding:utf-8 import sys import socket import sys im ...
- 第四章 使用jQuery操作DOM
第四章 使用jQuery操作DOM 一.DOM操作 在jQuery中的DOM操作主要可分为样式操作.文本和value属性值操作.节点操作: 节点操作又包含属性操作.节点遍历和CSS-DOM操作. 其中 ...
- 智能合约语言 Solidity 教程系列9 - 错误处理
这是Solidity教程系列文章第9篇介绍Solidity 错误处理. Solidity系列完整的文章列表请查看分类-Solidity. 写在前面 Solidity 是以太坊智能合约编程语言,阅读本文 ...
- C语言学习之弹跳小球
重新回过头来看了一遍C语言,才发现我自己的无知,C语言其实好强大,我之前学的不过是一点C语法和做几个数学题.正好3月份的考试要考C语言,重新学一遍,先是在中国大学mooc上把翁恺老师的C语言刷了一遍, ...
- (java基础)Java输入输出流及文件相关
字节流: 所有的字节输入输出都继承自InputStream和OutputStream,通常用于读取二进制数据,最基本单位为单个字节,如图像和声音.默认不使用缓冲区. FileInputStream和F ...
- ibatis的优缺点及可行性分析
1.优点 简单: 易于学习,易于使用,通过文档和源代码,可以比较完全的掌握它的设计思路和实现. 实用: 提供了数据映射功能,提供了对底层数据访问的封装(例如ado.net),提供了DAO框架,可以使我 ...
- List里边存放Object对象获取方式
if (tableListt != null && tableListt.size() > 0) { for (int i = 0; i < tableListt.size ...
- POJ-2240 Arbitrage---判断正环+枚举
题目链接: https://vjudge.net/problem/POJ-2240 题目大意: 已知n种货币,以及m种货币汇率及方式,问能否通过货币转换,使得财富增加. 思路: 由于这里问的是财富有没 ...