Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

persist item to the database table

Project description

scrapy database pipeline

Introduction

Use pipeline to persist item to the database, just provide the tablename

INSTALL

.. code:: shell

pip install scrapy_db_pipeline

Usage

configure on setting.py

.. code:: python

DB_HOST = 'localhost'
DB_USER = 'root'
DB_PASSWORD = 'password'
DB_NAME = 'db_name

ITEM_PIPELINES = {
   #...
   'scrapy_db_pipeline.pipelines.DBStorePipeline': 300,
   #...
}

write your item

.. code:: python

class CalendarItem(scrapy.Item):
    __table_name__ = 'your_table_name'
    some_item = scrapy.Field()  

tips: You must create the table before running Scrapy. Because I can't know what the type of your field on the database table.

TODO:

database support (if I have time):

  • <input type="checkbox" checked="" disabled="" /> mysql
  • <input type="checkbox" disabled="" /> ....

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 scrapy-db-pipeline, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size scrapy_db_pipeline-1.1-py3.7.egg (4.7 kB) File type Egg Python version 3.7 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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page