A
A
Anton Fedoryan2014-04-01 16:06:32
Python
Anton Fedoryan, 2014-04-01 16:06:32

Where can I find a simple sample database in Python?

Hello!
Please give me a simple example of creating a database using Sqlite and Python.
Understood how to create base with one table and to fill it.
It's not clear how to create a second table and link it to the first one, i.e. establish a one-to-many relationship.
As an example: there are several authors, and several book titles.
Each author can have multiple books, but only one author corresponds to a book.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valentine, 2014-04-01
@AnnTHony

If without any ORMs, create in the same way, only in the table with books make an additional author_id column, in which the author ID from the first one will be stored for each book.

S
Serge K, 2015-05-21
@korotkin

docs.sqlalchemy.org/en/rel_1_0/orm/tutorial.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question