Skip to content

Commit

Permalink
cleaned up the code , removed unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
shravan97 committed Aug 5, 2016
1 parent 55e8c39 commit 7388020
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion orm_creator/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from argparse import ArgumentParser as ap
from ormCreator import OrmCreator
import sys
import os
import getpass


Expand Down
14 changes: 1 addition & 13 deletions orm_creator/ormCreator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from sqlalchemy import *
from sqlalchemy.orm import *
import sys
import os
import re

Expand Down Expand Up @@ -54,14 +53,7 @@ def generate_file(self):

tables = self.fetch_tables() # Fetch all table info from DB

# Check if the file exists
try:
file = open(self.outfile, 'rw+')
except:
# Open a file in writing mode to create it first
file = open(self.outfile, 'w+')
file.close()
file = open(self.outfile, 'rw+')
file = open(self.outfile, 'w+')

file.seek(os.stat(file.name).st_size) # Seek the end of file

Expand All @@ -73,10 +65,6 @@ def generate_file(self):
file.write('from sqlalchemy.dialects.mysql import *\n')
file.write('from sqlalchemy.ext.declarative import declarative_base \n\n')
file.write('base = declarative_base()\n')
# file.close() # File has to be closed frequently for the file size to
# get updated

# file=open(self.outfile , 'rw+')

for table in tables:
# file.seek(os.stat(file.name).st_size)
Expand Down

0 comments on commit 7388020

Please sign in to comment.