Atnaujinkite slapukų nuostatas

Essential SQLAlchemy, 2e [Minkštas viršelis]

3.77/5 (135 ratings by Goodreads)
  • Formatas: Paperback / softback, 208 pages, aukštis x plotis x storis: 233x177x15 mm, weight: 370 g
  • Išleidimo metai: 05-Jan-2016
  • Leidėjas: O'Reilly Media
  • ISBN-10: 149191646X
  • ISBN-13: 9781491916469
Kitos knygos pagal šią temą:
  • Formatas: Paperback / softback, 208 pages, aukštis x plotis x storis: 233x177x15 mm, weight: 370 g
  • Išleidimo metai: 05-Jan-2016
  • Leidėjas: O'Reilly Media
  • ISBN-10: 149191646X
  • ISBN-13: 9781491916469
Kitos knygos pagal šią temą:
Dive into SQLAlchemy, the popular, open-source code library that helps Python programmers work with relational databases such as Oracle, MySQL, PostgresSQL, and SQLite. Using real-world examples, this practical guide shows you how to build a simple database application with SQLAlchemy, and how to connect to multiple databases simultaneously with the same metadata. SQL is a powerful language for querying and manipulating data, but it's tough to integrate it with your application. SQLAlchemy helps you map Python objects to database tables without substantially changing your existing Python code. If you're an intermediate Python developer with knowledge of basic SQL syntax and relational theory, this book serves as both a learning tool and a handy reference.Essential SQLAlchemy includes several sections: SQLAlchemy Core: Provide database services to your applications in a Pythonic way with the SQL Expression Language SQLAlchemy ORM: Use the object relational mapper to bind database schema and operations to data objects in your application Alembic: Use this lightweight database migration tool to handle changes to the database as your application evolves Cookbook: Learn how to use SQLAlchemy with web frameworks like Flask and libraries like SQLAcodegen
Preface vii
Introduction to SQLAIchemy xiii
Part I SQLAIchemy Core
1 Schema and Types
1(12)
Types
1(2)
Metadata
3(1)
Tables
4(5)
Columns
5(1)
Keys and Constraints
6(1)
Indexes
7(1)
Relationships and ForeignKeyConstraints
8(1)
Persisting the Tables
9(4)
2 Working with Data via SQLAIchemy Core
13(24)
Inserting Data
13(4)
Querying Data
17(11)
ResultProxy
18(2)
Controlling the Columns in the Query
20(1)
Ordering
20(1)
Limiting
21(1)
Built-In SQL Functions and Labels
22(2)
Filtering
24(1)
ClauseElements
25(1)
Operators
26(1)
Boolean Operators
27(1)
Conjunctions
27(1)
Updating Data
28(1)
Deleting Data
29(2)
Joins
31(1)
Aliases
32(1)
Grouping
33(1)
Chaining
34(1)
Raw Queries
35(2)
3 Exceptions and Transactions
37(14)
Exceptions
37(6)
AttributeError
38(2)
IntegrityError
40(1)
Handling Errors
41(2)
Transactions
43(8)
4 Testing
51(12)
Testing with a Test Database
51(7)
Using Mocks
58(5)
5 Reflection
63(8)
Reflecting Individual Tables
63(3)
Reflecting a Whole Database
66(1)
Query Building with Reflected Objects
66(5)
Part II SQLAIchemy ORM
6 Defining Schema with SQLAIchemy ORM
71(6)
Defining Tables via ORM Classes
71(3)
Keys, Constraints, and Indexes
73(1)
Relationships
74(1)
Persisting the Schema
75(2)
7 Working with Data via SQLAIchemy ORM
77(26)
The Session
77(3)
Inserting Data
80(3)
Querying Data
83(10)
Controlling the Columns in the Query
86(1)
Ordering
86(1)
Limiting
87(1)
Built-In SQL Functions and Labels
88(1)
Filtering
89(1)
Operators
90(2)
Boolean Operators
92(1)
Conjunctions
92(1)
Updating Data
93(1)
Deleting Data
94(3)
Joins
97(1)
Grouping
98(1)
Chaining
99(2)
Raw Queries
101(2)
8 Understanding the Session and Exceptions
103(18)
The SQLAIchemy Session
105(3)
Session States
105(3)
Exceptions
108(4)
MultipleResultsFound Exception
108(2)
DetachedInstanceError
110(2)
Transactions
112(9)
9 Testing with SQLAIchemy ORM
121(12)
Testing with a Test Database
121(9)
Using Mocks
130(3)
10 Reflection with SQLAIchemy ORM and Automap
133(6)
Reflecting a Database with Automap
133(2)
Reflected Relationships
135(4)
Part III Alembic
11 Getting Started with Alembic
139(4)
Creating the Migration Environment
139(1)
Configuring the Migration Environment
140(3)
12 Building Migrations
143(8)
Generating a Base Empty Migration
143(2)
Autogenerating a Migration
145(4)
Building a Migration Manually
149(2)
13 Controlling Alembic
151(6)
Determining a Database's Migration Level
151(1)
Downgrading Migrations
152(1)
Marking the Database Migration Level
153(1)
Generating SQL
154(3)
14 Cookbook
157(18)
Hybrid Attributes
157(3)
Association Proxy
160(6)
Integrating SQLAIchemy with Flask
166(3)
SQLAcodegen
169(6)
15 Where to Go from Here
175(2)
Index 177
Jason works at Emma as a Systems Software Engineer after spending 15 years as a systems architect and building data centers and cloud architectures for several of the largest tech companies, hospitals, stadiums, and telecomm providers. He's a passionate developer who regularly speaks at local and national events about technology. He's also the chair of the PyTennessee conference. He loves solving human problems, and has a side project, Sucratrend, devoted to helping diabetics manage their condition and improving their quality of life. He has used SQLAlchemy in web, data warehouse and analytics applications.Rick Copeland is the Principal Consultant and Founder at Arborian Consulting, a business focusing on MongoDB and Python custom development and training. Rick is a frequent speaker at MongoDB events, an avid MongoDB enthusiast, and is a charter member of 10gen's "Masters of MongoDB." In the non-MongoDB side of things, Rick is also a well-known Python developer and member of the Python Software Foundation, having contributed to a number of open-source projects and spoken at various evens and user groups. Rick is also the author of Essential SQLAlchemy, a book published by O'Reilly that introduces the reader to the excellent SQLAlchemy Python database toolkit.