#function used to get tickers from the tweets
def getTicker():
for tweet in tweets:
if "$" in tweet.text:
x = tweet.text.split()
for i in x:
if i.startswith("$") and i[1].isalpha():
tickList.append(i)
#running the ticker function
getTicker()
print(tickList)
#connecting to the database
conn = pyodbc.connect(
"Driver={SQL Server};"
"Server=SERVERNAME;"
"Database=DBNAME;"
"Trusted_Connection=yes;")
#query to put the tickers into the
cursor = conn.cursor()
# print(var_string)
cursor.execute('INSERT INTO master.dbo.TickerTable (TickerName) VALUES (?);', [','.join(tickList)])
conn.commit()
This inserts a list of tickers into the table but they all go in as one item instead of individually. Is there a way that I can take the list and insert the one by one?