Is there a maximum size to a Python program?

Paul Hemans darwin at nowhere.com
Mon Apr 27 00:34:45 EDT 2009


Thanks for the reply,

> Sounds like a needlessly complicated way of doing things. Surely
> replicating data from a database is a solved problem?
The data is coming from a legacy system and going into SQLalchemy to give 
database independence. We will probably update the legacy apps in the future 
but it is a massive job for little benefit.

> I don't understand what you mean by "with no current data". Do you mean
> that you generate 5MG of source code when the original postcode table is
> empty? Or 5MB of source code when the *replicated* table is empty? Or
> something else?
5MB of source code when the replicated table is empty

> Perhaps you could explain what the 5MB of code is supposed to do it, and
> how you generate the code, and show a *small* number of sample lines.
Here is a generated file that works. Other files are essentially the same 
but with more entries. This one only adds if the record does not exist, the 
next stage was to update an existing record with changes.

!/usr/bin/python
# -*- coding: utf-8 -*-
import schema
import time
from datetime import *
from sqlalchemy import *
from sqlalchemy.orm import *
engine = create_engine('sqlite:///tutorial.db', echo=False)
Session = sessionmaker(bind=engine)
session = Session()

entry = schema.BILLS()
exists = session.query(schema.BILLS).filter(schema.BILLS.REFNO==u"1")
if exists.count == 0:
    entry.REFNO = u"1"
    entry.THRDPTY = u"""C5"""
    entry.AMOUNT = 0
    entry.TIMESTAMP = 0
    entry.ALLOCATED = 0
    session.add(entry)

session.commit()
session.close() 





More information about the Python-list mailing list