Re: Formatting Embedded SQL

Roger Binns <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rich Shepard wrote:
|    It seems to me that when a large CREATE TABLE, SELECT, or similar
command
| is embedded in a python statement with line breaks for readability, that
| either pysqlite or squite3 becomes disoriented by the extra spaces. It
then
| complains and refuses to play nice. Is this a correct assumption?

Your assumption is incorrect.  Neither pysqlite nor sqlite3 cares about
extra whitespace.  What you are seeing is an interesting design decision
in SQLite.

When you create a table, the exact SQL you used to create it (white
space and all) is saved into the SQLite file.  SQLite does not produce
an normalized or a binary version of it.  One of the things that happens
on opening a database is that the schema has to be parsed to know which
fields various tables have.

One nice attribute of this approach is that features added in newer
versions of SQLite can suddenly work with schemas that were created in
older versions.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFdlewmOOfHg372QQRArOeAKDVyK0DV0XNi+TyuuEbQm8KxyxTpgCgxUuQ
ULqOcmxmrjdKHgmrV+ejFiA=
=hdr/
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.