Newbie Python SQL

L

len

Hi all

Could someone recommend a tutoral, book, white paper, etc. I am trying
to write a python program which takes a CSV file and through SQL insert
update my SQL files.

The SQL files contain a parent file with multiply child and
grandchildren plus various files for doing validation. I am using the
mxODBC module for access to the SQL files. I have, through the IDLE
connected done some simple queries and some testing of insert.

I believe I am past the initial stage on the SQL stuff but just can't
get to the next level. I have picked up several python book, but all
take a very introductory approach.

Any recommendation would be appreciated.

Len Sumnler
 
G

Gabriel Genellina

Could someone recommend a tutoral, book, white paper, etc. I am trying
to write a python program which takes a CSV file and through SQL insert
update my SQL files.

The SQL files contain a parent file with multiply child and
grandchildren plus various files for doing validation. I am using the
mxODBC module for access to the SQL files. I have, through the IDLE
connected done some simple queries and some testing of insert.

I believe I am past the initial stage on the SQL stuff but just can't
get to the next level. I have picked up several python book, but all
take a very introductory approach.

Any recommendation would be appreciated.

I think you need an SQL/database course rather than a Python one.


Gabriel Genellina
Softlab SRL





__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
 
D

Dennis Lee Bieber

Hi all

Could someone recommend a tutoral, book, white paper, etc. I am trying
to write a python program which takes a CSV file and through SQL insert
update my SQL files.

The SQL files contain a parent file with multiply child and
grandchildren plus various files for doing validation. I am using the
mxODBC module for access to the SQL files. I have, through the IDLE
connected done some simple queries and some testing of insert.

I believe I am past the initial stage on the SQL stuff but just can't
get to the next level. I have picked up several python book, but all
take a very introductory approach.

Any recommendation would be appreciated.
I think you need to look for a database text book, not a Python
text book.

First thing to clear up is terminology. To 99% of the world "SQL
files" are text files containing SQL /statements/. SQL is a
semi-standardized language for querying and manipulating databases.

This (following) is part of an "SQL file" (in this case, with
MySQL specifics):
-=-=-=-=-=-=-
CREATE DATABASE /*!32312 IF NOT EXISTS*/ BookList;

USE BookList;

--
-- Table structure for table `author`
--

CREATE TABLE author (
ID int(10) unsigned NOT NULL auto_increment,
Last char(40) NOT NULL default '',
First char(30) NOT NULL default '''''',
PRIMARY KEY (ID),
UNIQUE KEY FullName (Last,First)
) TYPE=InnoDB;

--
-- Dumping data for table `author`
--

INSERT INTO author VALUES (5,'Ascher','David');
INSERT INTO author VALUES (3,'Axmark','David');
INSERT INTO author VALUES (18,'Ben-Ari','M.');
INSERT INTO author VALUES (15,'Christiansen','Tom');
INSERT INTO author VALUES (7,'Drake Jr.','Fred L.');
INSERT INTO author VALUES (17,'Grayson','John E.');
INSERT INTO author VALUES (12,'Hekman','Jessica Perry');
INSERT INTO author VALUES (6,'Jones','Christopher A.');
INSERT INTO author VALUES (10,'Kline','Daniel');
INSERT INTO author VALUES (9,'Kline','Kevin');
INSERT INTO author VALUES (4,'Lutz','Mark');
INSERT INTO author VALUES (1,'MySQL AB','');
INSERT INTO author VALUES (13,'O\'Reilly & Associates, Inc.','the Staff
of');
INSERT INTO author VALUES (8,'Roman','Steven');
INSERT INTO author VALUES (16,'Schwartz','Randal L.');
INSERT INTO author VALUES (11,'Si Alhir','Sinan');
INSERT INTO author VALUES (14,'Wall','Larry');
INSERT INTO author VALUES (2,'Widenius','Michael \"Monty\"');
-=-=-=-=-=-=-=-

Nothing in your message tells us what database management system you
are using (ODBC is a specification for an interface layer between
applications and DBMS, with the goal of being transparent to either
side).

I suspect what you are calling "SQL files" are database /tables/
(or, in relational database theory: /relations/), which may or may not
be stored as discrete files depending upon the DBMS (M$ JET and SQLite
store multiple tables in one "database" file; Visual FoxPro uses three
files per table -- consolidated index, fixed width data, variable width
text data; MySQL MyISAM uses three files per table -- table definition,
index, data)

The problem now is figuring out what you mean by "child" and
"grandchild". In relational database theory, a relation is a single
table in which the data items of a tuple (a row, or record, to the
non-theorist) are all "related" to the unique key of that row. Linkages
to other relations, through "foreign keys" is not the definition of
"relation" in "relational database". These linkages are defined via
"join" clauses in SQL -- although the more capable database systems
allow for defining constraints to propagate changes in one table to an
associated table. For example, deleting a record in one table may mean
you have to delete all the records in another table that were linked to
that deleted record.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top