made hedonodon server ready
This commit is contained in:
parent
52223192b4
commit
2b98565444
10 changed files with 342 additions and 336 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,3 +9,4 @@ test.py
|
|||
.idea
|
||||
cardiffnlp
|
||||
venv
|
||||
logs.txt
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from DbSetup import engine, session, databaseUrl
|
||||
from DbSetup import connection, engine, session, databaseUrl
|
||||
import pandas as pd
|
||||
from sqlalchemy import desc, select
|
||||
from sqlalchemy import desc, select, sql
|
||||
from Tables import Toots
|
||||
|
||||
|
||||
|
|
@ -12,8 +12,8 @@ def calculateSentimentCount():
|
|||
HAVING datetime >= DATE("now","-1 day")
|
||||
AND datetime < DATE("now")'''
|
||||
return pd.read_sql(
|
||||
query,
|
||||
databaseUrl,
|
||||
sql.text(query),
|
||||
connection,
|
||||
parse_dates=["datetime"]
|
||||
)
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class CRUDManager():
|
|||
print(f'Could not save data to {table}!')
|
||||
|
||||
def loadFromDatabase(self, table:str, indexColumn=None):
|
||||
return pd.read_sql_table(table, databaseUrl, index_col=indexColumn)
|
||||
return pd.read_sql_table(table, connection, index_col=indexColumn)
|
||||
|
||||
def getLastToot(self):
|
||||
stmt = select(Toots.tootId).order_by(desc('datetime'))
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
|||
|
||||
databaseUrl = 'sqlite:///database.db'
|
||||
engine = create_engine(databaseUrl, future=True)
|
||||
connection = engine.connect()
|
||||
session = Session(engine)
|
||||
Base = declarative_base()
|
||||
|
||||
|
|
|
|||
2
Main.py
2
Main.py
|
|
@ -7,7 +7,7 @@ import matplotlib.pyplot as plt
|
|||
import matplotlib.dates as mdates
|
||||
from TootCrawler import TootCrawler
|
||||
|
||||
locale.setlocale(locale.LC_TIME, "en_EN.UTF-8")
|
||||
locale.setlocale(locale.LC_TIME, "en_US.UTF-8")
|
||||
init_db()
|
||||
|
||||
mastodonAccountManager = MastodonAccountManager()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ matplotlib
|
|||
pandas
|
||||
sqlalchemy
|
||||
vader-multi
|
||||
langdetect
|
||||
numpy
|
||||
pytz
|
||||
transformers
|
||||
wheel
|
||||
germansentiment
|
||||
scipy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue