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.

Files for sqlalchemy-mutablesoup, version 0.0.9
Filename, size File type Python version Upload date Hashes
Filename, size sqlalchemy_mutablesoup-0.0.9-py3-none-any.whl (5.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sqlalchemy-mutablesoup-0.0.9.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

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