explicit ARRAY type for SQLAlchemy
This commit is contained in:
parent
43665cff6d
commit
47130f30d7
@ -1,11 +1,12 @@
|
|||||||
import random
|
import random
|
||||||
|
from typing import List
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from requests_html import HTMLSession
|
from requests_html import HTMLSession
|
||||||
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select
|
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select, Column, ARRAY, String
|
||||||
|
|
||||||
with open("db.secrets", "r") as f:
|
with open("db.secrets", "r") as f:
|
||||||
db_pass = f.readline().strip()
|
db_pass = f.readline().strip()
|
||||||
@ -28,7 +29,7 @@ class Description(SQLModel, table=True):
|
|||||||
word: str | None = Field(default=None, foreign_key="word.word")
|
word: str | None = Field(default=None, foreign_key="word.word")
|
||||||
sense_id: int | None = Field(default=None, foreign_key="sense.id")
|
sense_id: int | None = Field(default=None, foreign_key="sense.id")
|
||||||
description: str
|
description: str
|
||||||
examples: list[str] | None
|
examples: List[str] | None = Field(sa_column=Column(ARRAY(String)))
|
||||||
|
|
||||||
|
|
||||||
class Pronunciation(SQLModel, table=True):
|
class Pronunciation(SQLModel, table=True):
|
||||||
|
Loading…
Reference in New Issue
Block a user