Hi Svilen,

    first of all, thank you for your answer.

On 3/8/07, svilen wrote:
>
> This is the db-file size, which is actual DB-implemenation detail, and
> which will probably only grow up - depends on the particular db u
> have. There are many strategies, like paging etc. e.g. some DBs
> require a whole partition just for themselves - dont even think of
> shrinking those...
> See your db's doco about some way to purge, clean, vacuum the db to
> get back the unused space.

Well, I am using sqlite, and at the beginning, when I create the empty
database, it has a size of 3 Kb. Then I add, let's say, 15 items with
their data and the database grows to 1 MB. Then I delete all the items
from the database, flush(), close() and whatever, and the database is
still 1 MB. I know next to nothing about SQLAlchemy and databases, and
I am sorry to ask dumb questions, but it seems to me that some space
should be cleaned...
I am surely missing something here.

Thank you for your suggestions.

Andrea.

> > Hi All,
> >
> >     at the end, I finally cracked the problem with the
> > tree-structured database with SQLAlchemy. I still have however a
> > problem.
> > I am using a "physical" database, not an in-memory one. I have
> > declared my Tables as follows:
> >
> > trees = Table('treenodes', metadata,
> >               Column('node_id', Integer,
> > Sequence('treenode_id_seq',optional=False), primary_key=True),
> >               Column('parent_node_id', Integer,
> > ForeignKey('treenodes.node_id'), nullable=True),
> >               Column('node_name', String(500), nullable=False),
> >               Column('formattedname', String(500), nullable=False),
> >               Column('data_ident', Integer,
> > ForeignKey('treedata.data_id')) )
> >
> >
> > treedata = Table("treedata", metadata,
> >                  Column('data_id', Integer, primary_key=True),
> >                  Column('value', String(100), nullable=False)
> >                  )
> >
> > mapper(TreeNode, trees, properties=dict(id=trees.c.node_id,
> >                                         name=trees.c.node_name,
> >
> > parent_id=trees.c.parent_node_id, children=relation(TreeNode,
> > cascade="all", backref=backref("parent",
> > remote_side=[trees.c.node_id]),
> >
> > collection_class=NodeList),
> >
> > data=relation(mapper(TreeData, treedata,
> > properties=dict(id=treedata.c.data_id)),
> >
> > cascade="all,delete,delete-orphan", lazy=False))
> >
> >
> > Everything goes ok, I can save my data to a database file called
> > MyDatabase.db. After saving few items, the database size is about
> > 180 Kb. So far so good. But when I delete one or more items (also
> > if I delete all the items) using:
> >
> > self.session.delete(bad_node)
> > self.session.flush()
> > self.session.clear()
> >
> > By printing the node names, I know that bad_node is no more there,
> > but its data seems to still live in the database. I mean, even if I
> > delete *all* the items, the database size is still 180 Kb, no
> > matter how much I flush(), clear(), close() and reopen the
> > database.
> > I am sure I am missing something. Which is the usual approach to
> > delete *permanently* things from a database?
> >
> > Thank you in advance for your suggestions.
> >
> > Andrea.
> >
> > "Imagination Is The Only Weapon In The War Against Reality."
> > http://xoomer.virgilio.it/infinity77/
> >
> >
>
> >
>


-- 
Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to