Skip to main content

Mutable BeautifulSoup database type

Project description

SQLAlchemy-MutableSoup defines a mutable BeautifulSoup SQLAlchemy database type.

Installation

$ pip install sqlalchemy-mutablesoup

Quickstart

from sqlalchemy_mutablesoup import MutableSoupType

from sqlalchemy import Column, Integer, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session

# standard session creation
engine = create_engine('sqlite:///:memory:')
session_factory = sessionmaker(bind=engine)
Session = scoped_session(session_factory)
session = Session()
Base = declarative_base()

# define and instantiate a model with a MutableSoupType column.
class Model(Base):
    __tablename__ = 'model'
    id = Column(Integer, primary_key=True)
    soup = Column(MutableSoupType)

Base.metadata.create_all(engine)

model = Model()
session.add(model)

You can now treat model.soup as a bs4.BeautifulSoup object.

Citation

@software{bowen2020sqlalchemy-mutablesoup,
  author = {Dillon Bowen},
  title = {SQLAlchemy-MutableSoup},
  url = {https://dsbowen.github.io/sqlalchemy-mutablesoup/},
  date = {2020-06-04},
}

License

Users must cite this package in any publications which use it.

It is licensed with the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy-mutablesoup-0.0.9.tar.gz (3.9 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page