python - 如何在scrapy中从sql(pyodbc)中读取数据
问题描述
我正在尝试使用 PyODBC 和 Scrapy 从我的 SQL 数据库中读取数据。我该怎么做呢?这是我到目前为止所拥有的:
import scrapy
import pyodbc
import pandas as pd
table = pd.read_sql_query("select top 10 * from Organization where countryid = 13 and revenue='unknown'",con)
class ZoominfoSpider(scrapy.Spider):
name = 'zoominfo'
def start_requests(self):
#con = database_connect():
for index in table.index:
company = table["Name"][index].strip()
url = f"https://www.google.com.ua/search?q={company + '+link+overview'}"
req = scrapy.Request(url=url, callback=self.parse_google_results, cb_kwargs={"company": company})
req.meta['proxy'] = None
yield req
解决方案
推荐阅读
- angular - Angular在Guard中获取匹配的url路径
- python-3.x - 如何使用python将word文档表上的普通文本更改为包含行和列的彩色文本
- android - openweathermap api 密钥不适用于签名的 apk
- database - 在 db2 中添加索引的建议
- wordpress - 联系表 7:仅重置某些字段?
- javascript - 如何更新网格的几何形状,将其分成两个相等的部分,并且两个部分都有不同的材料?
- scala - 使用“:”拆分后如何合并rdd中的连续值
- schema.org - 我应该为用户名使用哪种微格式架构?
- javascript - Highcharts 实心仪表未完全着色
- rest - 如何为特定情况设计rest uri?