Skip to Content
SQLAlchemy Esencial, 2ª Edición
book

SQLAlchemy Esencial, 2ª Edición

by Jason Myers, Rick Copeland
September 2024
Intermediate to advanced
208 pages
4h 41m
Spanish
O'Reilly Media, Inc.
Content preview from SQLAlchemy Esencial, 2ª Edición

Capítulo 1. Esquema y tipos

Este trabajo se ha traducido utilizando IA. Agradecemos tus opiniones y comentarios: translation-feedback@oreilly.com

La primera cosa que debemos hacer es definir qué datos contienen nuestras tablas, cómo se interrelacionan esos datos y cualquier restricción sobre ellos.

En para proporcionar acceso a la base de datos subyacente, SQLAlchemy necesita una representación de las tablas que deben estar presentes en la base de datos. Podemos hacerlo de tres maneras:

  • Utilizar objetos definidos por el usuario Table

  • Utilizar clases declarativas que representen tus tablas

  • Inferirlos de la base de datos

Este capítulo de se centra en la primera de ellas, ya que es el enfoque que se utiliza con SQLAlchemy Core; trataremos las otras dos opciones en capítulos posteriores, una vez dominados los fundamentos. Los objetos Table contienen una lista de columnas tipificadas y sus atributos, que se asocian a un contenedor de metadatos común. Comenzaremos nuestra exploración de las definiciones de esquemas echando un vistazo a los tipos disponibles para construir tablas en SQLAlchemy.

Tipos

En hay cuatro categorías de tipos que podemos utilizar dentro de SQLAlchemy:

  • Genérico

  • Norma SQL

  • Específico del vendedor

  • Definido por el usuario

SQLAlchemy define un gran número de tipos genéricos que se abstraen de los tipos SQL reales soportados por cada base de datos backend. Todos estos tipos están disponibles en el módulo sqlalchemy.types, y por comodidad también ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Aprender SQL, 3ª Edición

Aprender SQL, 3ª Edición

Alan Beaulieu
Essential SQLAlchemy, 2. Auflage

Essential SQLAlchemy, 2. Auflage

Jason Myers, Rick Copeland
SQL en una cáscara de nuez, 4ª edición

SQL en una cáscara de nuez, 4ª edición

Kevin Kline, Regina O. Obe, Leo S. Hsu

Publisher Resources

ISBN: 9781098198466