I'm using Peewee ORM with SQLite DB and i want to store chuck of HTML inside DB
I'm stucked between choosing a best suited field for storing HTML basically whole webpage including css js html etc whatever that webpage contains the webpage is being loaded via r = requests.get(url)
My Code:
class BaseModel(Model):
class Meta:
database = db
class Page(BaseModel):
raw_html = CharField(unique=True) # stucked here between choosing a best suited field
It's basically for scraping pages from site save the whole page or pages inside DB and since it'll be in DB i can later deal with that data extracting info or i can do whatever i want to do with it
i know i can use other scraper libs like scrap.py etc but i want to do it this way!
CharField
is not a good choice since it would require you to know the length of the data beforehand. Use TextField
instead - it was made to store arbitrarily large strings:
class Page(BaseModel):
raw_html = TextField(unique=True)