Anonymous avatar Anonymous committed 26fe6a2

matching worked for 100 transactions (warnings/logging tamed)

Comments (0)

Files changed (1)

 import pprint
 import logging
 import datetime
+import warnings
 
 import sqlalchemy
 from sqlalchemy import Column
 
 def show_tables(engine):
     meta = sqlalchemy.MetaData()
-    meta.reflect(bind=engine)
+
+    with warnings.catch_warnings():
+        warnings.simplefilter("module")
+        # "Did not recognize type 'BIGINT' of column .*")
+        meta.reflect(bind=engine)
     for t in meta.tables:
         print t
 
 
 
 def match(engine):
-    Base.metadata.reflect(bind=engine)
+    with warnings.catch_warnings():
+        #warnings.filterwarnings("once",
+        #                        "Did not recognize type 'BIGINT' of column .*")
+        warnings.simplefilter("ignore")
+        Base.metadata.reflect(bind=engine)
 
     # TODO: consider matching on account id rather than name.
 
     left join splitmatch on splitmatch.mint_tx_id = mtx.id
     where catmatch.split_guid is null
       and splitmatch.split_guid is null
+      and mtx.category != 'Exclude From Mint'
+      and mtx.isPending != 1
     order by mtx.id
     ''')
     rows = ans.fetchall()
-    log.info('mismatches: %d\n %s', len(rows), pprint.pformat(rows))
+    log.warn('mismatches: %d\n %s', len(rows), pprint.pformat(rows))
 
     ans = engine.execute('''
         select distinct mtx.categoryId as id, mtx.category as name
         left join splitmatch on splitmatch.mint_tx_id = mtx.id
         where catmatch.split_guid is null
           and splitmatch.split_guid is null
+          and mtx.category != 'Exclude From Mint'
+          and mtx.isPending != 1
         order by mtx.category
         ''')
-    log.info('mising categories: %s', pprint.pformat(ans.fetchall()))
+    log.warn('mising categories: %s', pprint.pformat(ans.fetchall()))
 
 
 def main(argv):
-    logging.basicConfig(level=logging.DEBUG)
+    logging.basicConfig(level=logging.WARN)
 
     if '--load' in argv:
         trxfn, dbfn = argv[2:4]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.