<s>
SQLAlchemy	B-Application
is	O
an	O
open-source	B-Application
SQL	B-Language
toolkit	O
and	O
object-relational	B-General_Concept
mapper	I-General_Concept
(	O
ORM	O
)	O
for	O
the	O
Python	B-Language
programming	I-Language
language	I-Language
released	O
under	O
the	B-License
MIT	I-License
License	I-License
.	O
</s>
<s>
SQLAlchemy	B-Application
's	O
philosophy	O
is	O
that	O
relational	O
databases	O
behave	O
less	O
like	O
object	O
collections	O
as	O
the	O
scale	O
gets	O
larger	O
and	O
performance	O
starts	O
being	O
a	O
concern	O
,	O
while	O
object	O
collections	O
behave	O
less	O
like	O
tables	O
and	O
rows	O
as	O
more	O
abstraction	O
is	O
designed	O
into	O
them	O
.	O
</s>
<s>
For	O
this	O
reason	O
it	O
has	O
adopted	O
the	O
data	O
mapper	O
pattern	O
(	O
similar	O
to	O
Hibernate	B-Library
for	O
Java	B-Language
)	O
rather	O
than	O
the	O
active	O
record	O
pattern	O
used	O
by	O
a	O
number	O
of	O
other	O
object-relational	B-General_Concept
mappers	I-General_Concept
.	O
</s>
<s>
It	O
is	O
shown	O
how	O
user-defined	O
Python	B-Language
classes	O
create	O
corresponding	O
database	O
tables	O
,	O
how	O
instances	O
with	O
relationships	O
are	O
created	O
from	O
either	O
side	O
of	O
the	O
relationship	O
,	O
and	O
finally	O
how	O
the	O
data	O
can	O
be	O
queried	O
—	O
illustrating	O
automatically	O
generated	O
SQL	B-Language
queries	O
for	O
both	O
lazy	B-General_Concept
and	O
eager	O
loading	O
.	O
</s>
<s>
Creating	O
two	O
Python	B-Language
classes	O
and	O
corresponding	O
database	O
tables	O
in	O
the	O
DBMS	O
:	O
</s>
<s>
SQLAlchemy	B-Application
issues	O
the	O
following	O
query	O
to	O
the	O
DBMS	O
(	O
omitting	O
aliases	O
)	O
:	O
</s>
<s>
Setting	O
lazy	B-General_Concept
=	O
True	O
(	O
default	O
)	O
instead	O
,	O
SQLAlchemy	B-Application
would	O
first	O
issue	O
a	O
query	O
to	O
get	O
the	O
list	O
of	O
movies	O
and	O
only	O
when	O
needed	O
(	O
lazy	B-General_Concept
)	O
for	O
each	O
director	O
a	O
query	O
to	O
get	O
the	O
name	O
of	O
the	O
corresponding	O
director	O
:	O
</s>
