Re: [Tutor] database question

2007-06-29 Thread Alan Gauld
"Luke Jordan" <[EMAIL PROTECTED]> wrote > I've created a database as a shelve, where each value in the shelve > file is > a record class instance that has attributes representing fields. > Let's say I > enter 300 records in the shelve, then I decide to add a field to > future > records, or rem

[Tutor] database question

2007-06-29 Thread Luke Jordan
I've created a database as a shelve, where each value in the shelve file is a record class instance that has attributes representing fields. Let's say I enter 300 records in the shelve, then I decide to add a field to future records, or remove a field from future records. How can I update the exis

Re: [Tutor] Database Table Primary Keys

2006-11-21 Thread Glenn T Norton
Tod Haren wrote: >Using a DBAPI 2.0 module such as ADODBAPI, how can a I identify the >primary key fields of a table. cursor.desctription doesn't hold this >info, unless I'm missing something. I just don't see it in the >documentation. Maybe there's an SQL statement I haven't found yet. > >Is t

[Tutor] Database Table Primary Keys

2006-11-21 Thread Tod Haren
Using a DBAPI 2.0 module such as ADODBAPI, how can a I identify the primary key fields of a table. cursor.desctription doesn't hold this info, unless I'm missing something. I just don't see it in the documentation. Maybe there's an SQL statement I haven't found yet. Is this even possible? I'm

Re: [Tutor] database question

2006-10-27 Thread Alan Gauld
> For example > with "SELECT * FROM a", I use this code > > ... to know how many columns are in the result, As a general rule its better to avoid "Select * From" in production SQL. If the table definition changes the data returned can change in unexpected ways and break your application. In addi

[Tutor] database question

2006-10-27 Thread euoar
I'm learning to use python with the database mysql. I'm writing a widget in pygtk that should show the results of a sql query. For example with "SELECT * FROM a", I use this code count = 0 a = db.cursor.description for tuple in a: print tuple[0][0] count = count + 1

Re: [Tutor] database web app, what tool?

2006-10-02 Thread Eric Walstad
Hey Paulino, I'm a Django fan but from your description, a simple CGI app might do nicely. Heck, you've already got the code written, just wrap it in a CGI script that formats your list of records in HTML and serve the script from your (already setup?) apache or even from your workstation wit

Re: [Tutor] database web app, what tool?

2006-10-01 Thread Liam Clarke
Paulino wrote: Hi Paulino, Tough question that. What is your existing web server? That'd be a good starting point. Zope/Plone are great, but they have a steep learning curve that doesn't seem essential to what you're doing. Django is simpler, but once again, doesn't immediately fit to what you

[Tutor] database web app, what tool?

2006-10-01 Thread Paulino
Hi! Im a very biginner in programming and I started with python, witch I found much easier tahn i thought. I want to build an intranet page in my organization that shows some data from our financial aplication's database. For the starting point I would like it to show invoices lists per suppl

Re: [Tutor] database help for newbie, fetchall()

2006-06-26 Thread Alan Gauld
> What is the best way to handle the resutls to a fetchall() command? > The result seems to be a list of tuples > [(aaa,bbb,ccc0,(11,222,333,)]. Yes, thats usually the most convenient way to present groups of data. > I'm new to programming but it seems that what ever I try to > accomplish > at

Re: [Tutor] database help for newbie, fetchall()

2006-06-26 Thread Python
On Sun, 2006-06-25 at 20:14 -0400, Rene Bourgoin wrote: > What is the best way to handle the resutls to a fetchall() command? > The result seems to be a list of tuples [(aaa,bbb,ccc0,(11,222,333,)]. Correct > I'm new to programming but it seems that what ever I try to accomplish > at some point i

[Tutor] database help for newbie, fetchall()

2006-06-25 Thread Rene Bourgoin
What is the best way to handle the resutls to a fetchall() command? The result seems to be a list of tuples [(aaa,bbb,ccc0,(11,222,333,)]. I'm new to programming but it seems that what ever I try to accomplish at some point i need the results to end up as strings. Even if you loop through the li

Re: [Tutor] Database topic now fixed

2006-05-15 Thread Alan Gauld
>Does that mean you will soon fix the tutor.tgz :-) > Thanks for all the hard work you put into this. I updated the PDF. zip and tgz files at the same time I uploaded the fixed database topic, but before I made the additional fixes Bob suggested Alan G.

[Tutor] Database topic now fixed

2006-05-14 Thread S W Collier
Alan, Does that mean you will soon fix the tutor.tgz :-) Thanks for all the hard work you put into this. Stan. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Database topic now fixed

2006-05-13 Thread Alan Gauld
> Some observations: These have now all been addressed as previously discussed. I've also added a section at the end covering the use of execute() to insert parameters rather than relying on format strings since the latter can be a security risk. Hopefully its now complete! :-) Alan Gauld Autho

Re: [Tutor] Database topic now fixed

2006-05-13 Thread Alan Gauld
Thanks Bob, Feedback is always appreciated, its how the tutor improves. > 1 - people familiar with other databases might be puzzled by the > lack of column datatypes. I'd mention that sqlite allows but does > not require types at the first introduction of CREATE TABLE,. Fair point, although by

Re: [Tutor] Database topic now fixed

2006-05-13 Thread Bob Gailer
Alan Gauld wrote: > The mistakes in my databae topic have now been rectified. > I have no idea how I managed to post the file without testing > that section of code. And unfortunately it's one of the areas > where SqlLite SQL syntax varies from the Oracle syntax that > I'm most familiar with. Bu

[Tutor] Database topic now fixed

2006-05-13 Thread Alan Gauld
The mistakes in my databae topic have now been rectified. I have no idea how I managed to post the file without testing that section of code. And unfortunately it's one of the areas where SqlLite SQL syntax varies from the Oracle syntax that I'm most familiar with. But that's only a partial excu

Re: [Tutor] Database Connectivity

2006-04-11 Thread Mike Hansen
> Kaushal Shriyan wrote: > > Hi ALL > > > > How do i connect my python program to MySQL DB or Oracle DB > or can you > > please specify the URL which gives a detailed explanation on this. > > Basic connectivity is through modules that implement the > DB-API standard. Read the spec and find

Re: [Tutor] Database Connectivity

2006-04-11 Thread Kent Johnson
Kaushal Shriyan wrote: > Hi ALL > > How do i connect my python program to MySQL DB or Oracle DB or can you > please specify the URL which gives a detailed explanation on this. Basic connectivity is through modules that implement the DB-API standard. Read the spec and find implementations here: h

Re: [Tutor] Database Connectivity

2006-04-11 Thread Ed Singleton
On 11/04/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: > Hi ALL > > How do i connect my python program to MySQL DB or Oracle DB or can you > please specify the URL which gives a detailed explanation on this. SQLObject is your best bet: http://www.sqlobject.org/ If you're using MySQL, you will ne

[Tutor] Database Connectivity

2006-04-11 Thread Kaushal Shriyan
Hi ALL How do i connect my python program to MySQL DB or Oracle DB or can you please specify the URL which gives a detailed explanation on this. Thanks in Advance Regards Kaushal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/l

Re: [Tutor] database app

2005-06-23 Thread Christian Wyglendowski
> -Original Message- > > Hey there, Hi, > i have used the cgi module and dig it. > heres the deal, > my employer wants me to build a dynamic website that will > access a > database and display customer > information on web. ok, easy enough. Looks like some others have

Re: [Tutor] database app

2005-06-22 Thread nephish
Alan G wrote: >>>going on at a time I'd consider moving the database >>>or using snapshot technology or similar, Access locks >>>by pages (default 2K?) which can mean a lot of data >>>rows being locked by a single update. >>> >>> >>> >>ok, another question about this, if i use a snapshot, co

Re: [Tutor] database app

2005-06-19 Thread Alan G
> database and display customer information on web. ok, easy enough. > heres the trick. the database is MS Access. - ick. ick indeed, but maybe for different reasons... There is an ODBC database driver that you can use to access Access. But you will have to be careful about locking if the

[Tutor] database app

2005-06-18 Thread nephish
Exactly what i was looking for. thanks gents, i didn't even know this module existed. i guess this access project will not be as intimidating as i thought. cheers ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] database app

2005-06-18 Thread Chad Crabtree
Well when working with M$ db's you should use odbc. http://www.egenix.com/files/python/mxODBC.html nephish wrote: >Hey there, > >i have used the cgi module and dig it. >heres the deal, >my employer wants me to build a dynamic website that will access a >database and display customer

Re: [Tutor] database app

2005-06-18 Thread Don Parris
On Sat, 18 Jun 2005 13:50:56 -0700 nephish <[EMAIL PROTECTED]> wrote: > Hey there, > > i have used the cgi module and dig it. > heres the deal, > my employer wants me to build a dynamic website that will access a > database and display customer > information on web. ok, easy enou

[Tutor] database app

2005-06-18 Thread nephish
Hey there, i have used the cgi module and dig it. heres the deal, my employer wants me to build a dynamic website that will access a database and display customer information on web. ok, easy enough. heres the trick. the database is MS Access. - ick. what could i do to

Re: [Tutor] Database connections don't stay alive

2005-06-06 Thread Joe Healy
Hi there, I have mainly used the psycopg module to connect. It seems to work quite well. quick example: import psycopg conn = psycopg.connect("dbname=mydatabase password= host= user=") cur = conn.cursor() cur.execute('select * from transit;') results = cur.fetchall() Hope this

Re: [Tutor] Database connections don't stay alive

2005-06-03 Thread Kent Johnson
Olli Rajala wrote: > Well, I asked about tutorials, but maybe this was not so good day, > because it has been quite "silent". :) > > So, good tutorials are still welcome, though I know now how to connect > to the Postgresql database. I just have some problems, though. You might want to try aski

[Tutor] Database connections don't stay alive

2005-06-03 Thread Olli Rajala
Well, I asked about tutorials, but maybe this was not so good day, because it has been quite "silent". :) So, good tutorials are still welcome, though I know now how to connect to the Postgresql database. I just have some problems, though. With MySQL I can do like this: import MySQLdb def connec

Re: [Tutor] database applications with Python - where to start

2005-05-05 Thread Alan Gauld
other month at least before its fully done! I've got an awful lot in my diary just now! - Original Message - From: "Barnaby Scott" <[EMAIL PROTECTED]> To: Sent: Thursday, May 05, 2005 2:03 PM Subject: [Tutor] database applications with Python - where to start >

Re: [Tutor] database applications with Python - where to start

2005-05-05 Thread William O'Higgins
On Thu, May 05, 2005 at 02:03:30PM +0100, Barnaby Scott wrote: >Hi, this is one of those difficult questions about where to start! > >I want to create a book-keeping/accounting application for my own use >1. because I can't find any that suits me, and >2. because I want to improve and extend my kno

[Tutor] database applications with Python - where to start

2005-05-05 Thread Barnaby Scott
Hi, this is one of those difficult questions about where to start! I want to create a book-keeping/accounting application for my own use 1. because I can't find any that suits me, and 2. because I want to improve and extend my knowledge of Python. Clearly this is going to be a database applicatio

Re: [Tutor] database access to MSSQL

2005-04-06 Thread Kent Johnson
Ryan Davis wrote: Does anyone know of a decent way to access a SQL Server 2000 database? I make heavy use of SQL Server from Jython using Microsoft's JDBC driver. This works great if it is an option for you. Otherwise if your client is on Windows take a look at adodbapi. I have just played around

[Tutor] database access to MSSQL

2005-04-06 Thread Ryan Davis
Does anyone know of a decent way to access a SQL Server 2000 database? I've gotten some versions working using dbi,odbc and defining a DSN on the computer, but I'd like to be able to specify a server, user, pass, and database in code. As far as I can tell, I'd have to define a DSN for every dat

Re: [Tutor] database programming

2005-02-21 Thread Alan Gauld
> Oh, and don't forget the c.commit() part! That had me running around > in circles all night last night. Yep, I got got with lack of commit syndrome when I started with SQL too :-) > PS Anyone know if there's a way to get a list of tables in a DB? I've > got the pragma to get a list of columns i

Re: [Tutor] database programming

2005-02-21 Thread Liam Clarke
/me smacks head. Thanks Kent. Exactly what I need. Regards, Liam Clarke On Mon, 21 Feb 2005 16:21:23 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Liam Clarke wrote: > > > PS Anyone know if there's a way to get a list of tables in a DB? I've > > got the pragma to get a list of columns in

Re: [Tutor] database programming

2005-02-21 Thread Kent Johnson
Liam Clarke wrote: PS Anyone know if there's a way to get a list of tables in a DB? I've got the pragma to get a list of columns in a table, but just in the off chance... AFAIK there is no standard way to do this - it is different for each database. For SQLite, see this FAQ: http://www.sqlite.org/

Re: [Tutor] database programming

2005-02-21 Thread Liam Clarke
>>>import sqlite >>>x = sqlite.connect('mysqlitedb') >>>cx = x.cursor() >>>cx.execute( 'create table foo (columnA varchar(15), columnB number(3))' ) >>>cx.execute ('insert into foo (columnA, columnB) values ("Parrot", 90)') >>>x.commit() >>>cx.execute('select * from foo') >>>cx.fetchall() [('Parr

Re: [Tutor] database programming

2005-02-21 Thread Danny Yoo
On Mon, 21 Feb 2005, Chris Mallari wrote: > hi there! can u pls send me sample code in accessing a simple database > using python. Hi Chris, You may want to look at the Database topic guide: http://www.python.org/topics/database/ It has links to examples, tutorials, and other documentati

Re: [Tutor] database programming

2005-02-21 Thread Michael Dunn
Hi Chris, If you just want to learn about databases, then sqlite is a good way to go. It's small, it's typeless (which means you don't have to define ahead of time what sort of thing is going to go in which bit of the database; python is typeless too), and it is not split into client and server (m

[Tutor] database programming

2005-02-21 Thread Chris Mallari
hi there! can u pls send me sample code in accessing a simple database using python. Chris Mallari thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Database

2005-02-11 Thread Matt Williams
I would recommend KirbyBase as a quick starter - it's nice and simple, and outputs text files, so you can always check things manually. http://www.netpromi.com/kirbybase.html Matt ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/