From 1637ab6d824cc4f27820685a061fbf7d09ca38da Mon Sep 17 00:00:00 2001 From: ydb5755 Date: Wed, 9 Oct 2024 14:42:21 +0300 Subject: [PATCH] testing --- instance/site.db | Bin 40960 -> 40960 bytes pythonFiles/playground.py | 52 ++++++++------------------------------ 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/instance/site.db b/instance/site.db index 790128e9351f01a617bc4e78a6572692af787ed0..4db0c73af170e2ab843297bd7f578b59f33b6537 100644 GIT binary patch delta 43 zcmZoTz|?SnX@WFk%0wAw#*~c-xBQuSgEtEbi1TuBNU<=8G87jV7jKS@UF-w^CkzbX delta 29 lcmZoTz|?SnX@WFk!bBNo#)ORtxBNE?3Mlh#j*VUH1OT3o3UUAd diff --git a/pythonFiles/playground.py b/pythonFiles/playground.py index b741ec5..4d7a89c 100644 --- a/pythonFiles/playground.py +++ b/pythonFiles/playground.py @@ -1,7 +1,7 @@ import datetime import openpyxl import time -from sqlalchemy import create_engine, MetaData, Table, select +from sqlalchemy import create_engine, MetaData, Table, select, distinct, extract import os def engineer(): @@ -25,46 +25,16 @@ def playground(): vendor_table = Table("vendor", metadata_obj, autoload_with=engine) with engine.connect() as conn: - lis = conn.execute(select(line_item_table)) - # xl = openpyxl.load_workbook('C:/Users/Lenovo/Desktop/BudgetingApp/app/static/uploadable/Bulk_Line_Item_Upload.xlsx',read_only=True) - # wb = xl.worksheets[0] - # items_to_add = [] - # for line, row in enumerate(wb.rows): - # row = [x.value for x in row] - # if line == 0: - # columns = {x: i for i,x in enumerate(row)} - # continue - # if row[columns['Charge']]: - # amount=row[columns['Charge']] * -1 - # else: - # amount=row[columns['Deposit']] - # date = row[0] - # date = time.mktime(date.timetuple()) - # line_item = { - # 'parent_line_item_id':None, - # 'amount':amount, - # 'currency_type':'shekel', - # 'vendor_id':None, - # 'date':date, - # 'confirmation_code':row[columns['Confirmation Code']], - # 'note':row[columns['Note']] - # } - # items_to_add.append(line_item) - # print(len(items_to_add)) - # print(items_to_add[51]) - - # month = datetime.datetime.now().date().month - # year = datetime.datetime.now().date().year - # print(month) - # print(year) - # print(type(month)) - # print(type(year)) - # print(datetime.datetime.now(datetime.timezone.utc).timestamp()) - - # today = datetime.datetime.today().date() - # today = time.mktime(today.timetuple()) - # print(today) + x = conn.execute(select(line_item_table.c.date)).all() + print(x) + # lis = [datetime.datetime.fromtimestamp(s) for s in conn.execute(select(distinct(line_item_table.c.date))).scalars().all()] + # month_year = {(s.month, s.year) for s in lis} + + # month_year = [datetime.datetime(year=x[1], month=x[0], day=1) for x in month_year] + # month_year.sort() + # return [x.strftime("%b %Y") for x in month_year] if __name__ == '__main__': - playground() \ No newline at end of file + # print(playground()) + print(datetime.datetime.strptime('Aug', "%b").month) \ No newline at end of file