469,909 Members | 1,562 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

how to pipe to variable of a "here document"

hi

I need to execute sql command using a "here document" like in unix.

os.popen("osql", "w").write("""\
select * from table
go
""")

how can i pipe these result of the select into a variable?
thanks

Apr 10 '06 #1
3 1717
ei***********@yahoo.com writes:
I need to execute sql command using a "here document" like in unix.

os.popen("osql", "w").write("""\
select * from table
go
""")

how can i pipe these result of the select into a variable?


popen doesn't work that way. you can only open them read or write.
you'll have to create a couple of pipes (one for reading, one for
writing), do a fork, execve, etc with the posix api. at least that's
how one does it in C...i'm a bit new to python so there might be
better ways.

--
burton samograd kruhft .at. gmail
kruhft.blogspot.com www.myspace.com/kruhft metashell.blogspot.com
Apr 10 '06 #2
In article <je********************************@4ax.com>,
Dennis Lee Bieber <wl*****@ix.netcom.com> wrote:
Question: Is there a DB-API module that can directly connect to the
database server?


There certainly is for MySQL, which is what I mostly use.
Apr 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Boki | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.