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等框架一样,通过实体与数据表的映射,实现关系数据库持久化. ...
随机推荐
- android 运行时异常捕获
1,将运行时异常捕获并存到手机SD卡上 可以直接使用logcat 命令Runtime.getRuntime().exec("logcat -f "+ file.getAbsolut ...
- python全栈开发-re模块(正则表达式)应用(字符串的处理)
一.概述 就其本质而言,正则表达式(或 RE)是一种小型的.高度专业化的编程语言,要讲他的具体用法要讲一本书!它内嵌在Python中,并通过 re 模块实现.你可以为想要匹配的相应字符串集指定规则:该 ...
- LXC学习实践(1)LXC的概念和用途
1.LXC是什么? LXC是Linux containers的简称,是一种基于容器的操作系统层级的虚拟化技术,Sourceforge上有LXC这个开源项目. 2.LXC能做什么? LXC和Linux内 ...
- 阿里云API网关(4)快速入门(开放 API)
网关指南: https://help.aliyun.com/document_detail/29487.html?spm=5176.doc48835.6.550.23Oqbl 网关控制台: https ...
- Linux网络配置(仅主机模式)
1.启动虚机,网络选择:仅主机模式 2.命令行输入 rm -rf /etc/udev/rules.d/70-persistent-net.rules 3.修改虚机中的网络配置 >>vim ...
- intelj idea中JRebel激活
1.下载激活软件 https://github.com/ilanyu/ReverseProxy/releases/tag/v1.0 我这边下载的是: 2.双击运行 3.idea中, 不出意外,应该就激 ...
- List里边存放Object对象获取方式
if (tableListt != null && tableListt.size() > 0) { for (int i = 0; i < tableListt.size ...
- python 类的进阶
类的进阶 一 isinstance(obj,cls)和issubclass(sub,super) class Foo: def __init__(self,name): self.name = nam ...
- TSQL:判定一段数组连续的数字段有多少的方案
给定了一列数字,需要判定该列中连续的数据字有多少条记录: field1,field2 , , , , , create table tbl( field1 int, field2 int ) ,); ...
- SQL server2017的操作(练习题)
题目: 假设有教材管理数据库BM,包括3个基本表: 教材(书号,书名,作者,出版社) B(Bno, Bname, Author, pub) 班级(班号,专业,所在系,人数) C(Cno, Spe, D ...