Skip to content

Commit

Permalink
[tutorial] 영문 번역을 작성한다 (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Hyeon <[email protected]>
Co-authored-by: heumsi <[email protected]>
  • Loading branch information
3 people authored Dec 28, 2023
1 parent 3462b0e commit 0b70dd5
Show file tree
Hide file tree
Showing 13 changed files with 3,279 additions and 40 deletions.
123 changes: 83 additions & 40 deletions src/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
const { description } = require('../../package')

module.exports = {
/**
* Ref:https://v1.vuepress.vuejs.org/config/#title
*/
title: '파이썬 개발자를 위한 SQLAlchemy',
/**
* Ref:https://v1.vuepress.vuejs.org/config/#description
*/
description: description,

base: "/sqlalchemy-for-pythonist/",

// Path
locales: {
'/': {
lang: 'ko',
title: '파이썬 개발자를 위한 SQLAlchemy',
description: description,
},
'/en/': {
lang: 'en-US',
title: 'SQLAlchemy for Python Developers',
description: 'This is a document that simplifies SQLAlchemy for easy understanding.',
}
},

/**
* Extra tags to be injected to the page HTML `<head>`
*
Expand All @@ -38,38 +43,76 @@ module.exports = {
* ref:https://v1.vuepress.vuejs.org/theme/default-theme-config.html
*/
themeConfig: {
repo: '',
editLinks: true,
docsDir: '',
editLinkText: '',
lastUpdated: true,
smoothScroll: true,
nav: [
{
text: 'GitHub',
link: 'https://github.com/SoogoonSoogoonPythonists/sqlalchemy-for-pythonist'
locales: {
'/': {
repo: '',
editLinks: true,
docsDir: '',
editLinkText: '',
lastUpdated: true,
smoothScroll: true,
nav: [
{
text: 'GitHub',
link: 'https://github.com/SoogoonSoogoonPythonists/sqlalchemy-for-pythonist'
},
],
sidebar: {
'/tutorial/': [
{
title: 'Tutorial',
path: '/tutorial/',
collapsable: false,
children: [
'1. 튜토리얼 개요',
'2. 연결 설정하기',
'3. 트랜잭션과 쿼리 실행하기',
'4. 데이터베이스 메타데이터로 작업하기',
'5.1. Core와 ORM 방식으로 행 조회하기',
'5.2. Core 방식으로 행 삽입하기',
'5.3. Core 방식으로 행 수정 및 삭제하기',
'6. ORM 방식으로 데이터 조작하기',
'7. ORM 방식으로 관련 개체 작업하기',
]
},
]
}
},
],
sidebar: {
'/tutorial/': [
{
title: 'Tutorial',
path: '/tutorial/',
collapsable: false,
children: [
'1. 튜토리얼 개요',
'2. 연결 설정하기',
'3. 트랜잭션과 쿼리 실행하기',
'4. 데이터베이스 메타데이터로 작업하기',
'5.1. Core와 ORM 방식으로 행 조회하기',
'5.2. Core 방식으로 행 삽입하기',
'5.3. Core 방식으로 행 수정 및 삭제하기',
'6. ORM 방식으로 데이터 조작하기',
'7. ORM 방식으로 관련 개체 작업하기',
'/en/': {
repo: '',
editLinks: true,
docsDir: '/en/',
editLinkText: '/en/',
lastUpdated: true,
smoothScroll: true,
nav: [
{
text: 'GitHub',
link: 'https://github.com/SoogoonSoogoonPythonists/sqlalchemy-for-pythonist'
},
],
sidebar: {
'/en/tutorial/': [
{
title: 'Tutorial',
path: '/en/tutorial/',
collapsable: false,
children: [
'1. Tutorial Overview',
'2. Setting Up a Connection',
'3. Executing Transactions and Queries',
'4. Working with Database Metadata',
'5.1. Querying Rows Using Core and ORM',
'5.2. Inserting Rows Using Core',
'5.3. Modifying and Deleting Rows Using Core',
'6. Manipulating Data Using ORM',
'7. Working with Related Objects Using ORM',
]
},
]
},
]
}
}
},
},
},

/**
Expand All @@ -80,5 +123,5 @@ module.exports = {
'@vuepress/plugin-medium-zoom',
["sitemap", { hostname: "https://soogoonsoogoonpythonists.github.io/sqlalchemy-for-pythonist/" }],
["@vuepress/last-updated"],
]
],
}
8 changes: 8 additions & 0 deletions src/en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
home: true
heroImage: https://media.vlpt.us/images/zamonia500/post/6dd8b08b-a089-49db-a2f1-921ad6a9649e/connect-a-flask-app-to-a-mysql-database-with-sqlalchemy-and-pymysql.jpg
tagline: This is a document that simplifies SQLAlchemy for easy understanding.
actionText: Tutorial →
actionLink: /en/tutorial/
footer: Made by soogoonsoogoon pythonists ❤️
---
42 changes: 42 additions & 0 deletions src/en/tutorial/1. Tutorial Overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Tutorial Overview

<br>

## Overview

SQLAlchemy is a library in Python that facilitates the connection to databases and the use of ORM (Object-Relational Mapping).
For instance, you can execute specific queries in your code and perform a series of operations in the database through ORM objects.

<br>

## Installation

SQLAlchemy can be installed as follows:

```bash
$ pip install sqlalchemy
```

The version being used is as follows:

```python
>>> import sqlalchemy
>>> sqlalchemy.__version__
1.4.20
```

<br>

## Offerings

SQLAlchemy is offered in the following two ways:

- **Core**
- This is the database toolkit and the foundational architecture of SQLAlchemy.
- It manages connections to databases, interacts with database queries and results, and provides tools to programmatically compose SQL statements.
- **ORM**
- Built on top of Core, it provides optional **ORM** (Object-Relational Mapping) features.

It is generally recommended to understand Core first before using ORM.
This tutorial will start by explaining Core.

27 changes: 27 additions & 0 deletions src/en/tutorial/2. Setting Up a Connection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Setting up a Connection

<br>

## Connecting to a Database

Let's try connecting to SQLite, a relatively lightweight database.
You can do it as follows:

```python
>>> from sqlalchemy import create_engine
>>> engine = create_engine("sqlite+pysqlite:///:memory:", echo=True, future=True)
```

- Use the `sqlalchemy.create_engine` function to create an **'engine'** that establishes a connection to the database.
- The first argument is a **`string URL`**.
- Typically, the `string URL` is structured as `dialect+driver://username:password@host:port/database`.
- If you don't specify a `driver`, SQLAlchemy's default settings will be used.
- Here, `sqlite+pysqlite:///test.db` is the `string URL`.
- For `sqlite`, the format follows `sqlite://<nohostname>/<path>`.
- From the string URL `sqlite:///test.db`, we can understand the following information:
- **Which database** to use (`dialect`, in this case, `sqlite`)
- **Which database API** (the driver interacting with the database) to use (in this case, `pysqlite`)
- **How to find** the database (in this case, it uses the in-memory feature provided by `sqlite`)
- Setting the `echo` parameter to `True` prints all executed SQL.

Creating an engine doesn't yet attempt an actual connection. The real connection occurs only when a request to perform an operation on the database is received for the first time.
Loading

0 comments on commit 0b70dd5

Please sign in to comment.