473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SQL package

Hi

I am trying to write a little a script that can be configurable. This
script should access to a database, that can be of any type (MySQL,
Postgres, SQLite, MS, etc).It has only to perform 2 or 3 simple plain
SQL queries. Hi have tested SQLAlchemy, and it is great, but too much
for my requirements, and I don't have any object relation with the
database tables. All I need is to access any database type in the same
way (mysql://user:pass@localhost/database, pgsqll://user:pass@localhost/database,
....) and run some basic queries. I have searched for this, but I have
not found any solution. Could you help me please?

If not, how can I run a simple query in SQLAlchemy? And iter the
results? I have tried this without success:

engine = create_engine('postgres://user:pass@localhost/database',
echo=True)
results = engine.execute("SELECT * FROM TABLE")
for result in results:
print result
Aug 26 '08 #1
2 1054
Juan schrieb:
Hi

I am trying to write a little a script that can be configurable. This
script should access to a database, that can be of any type (MySQL,
Postgres, SQLite, MS, etc).It has only to perform 2 or 3 simple plain
SQL queries. Hi have tested SQLAlchemy, and it is great, but too much
for my requirements, and I don't have any object relation with the
database tables. All I need is to access any database type in the same
way (mysql://user:pass@localhost/database, pgsqll://user:pass@localhost/database,
...) and run some basic queries. I have searched for this, but I have
not found any solution. Could you help me please?

If not, how can I run a simple query in SQLAlchemy? And iter the
results? I have tried this without success:

engine = create_engine('postgres://user:pass@localhost/database',
echo=True)
results = engine.execute("SELECT * FROM TABLE")
for result in results:
print result
Please read the documentation of sqlalchemy:

http://www.sqlalchemy.org/docs/05/sqlexpression.html

There is a very comprehensive example on that site what you should be
able to follow.

Diez
Aug 27 '08 #2
Juan schrieb:
Hi

I am trying to write a little a script that can be configurable. This
script should access to a database, that can be of any type (MySQL,
Postgres, SQLite, MS, etc).It has only to perform 2 or 3 simple plain
SQL queries. Hi have tested SQLAlchemy, and it is great, but too much
for my requirements, and I don't have any object relation with the
database tables. All I need is to access any database type in the same
way (mysql://user:pass@localhost/database, pgsqll://user:pass@localhost/database,
...) and run some basic queries. I have searched for this, but I have
not found any solution. Could you help me please?

If not, how can I run a simple query in SQLAlchemy? And iter the
results? I have tried this without success:

engine = create_engine('postgres://user:pass@localhost/database',
echo=True)
results = engine.execute("SELECT * FROM TABLE")
for result in results:
print result
sqlalchemy is the way to go, and you should consider actually reading
the documentation - the above clearly shows that you didn't.

http://www.sqlalchemy.org/docs/05/sqlexpression.html

Here you can see what is needed:
Sep 2 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck...
3
by: Petterson Mikael | last post by:
Hi, I have the following package names ( in an xml) that I will transform to html. I need to sort them. <package name="se.company.product.subproduct.boam.fpx.testsignals"> <package...
10
by: datapro01 | last post by:
Running DB2 8.1.6A on AIX 5.1 We are experience package cache overflows. The high water mark for package cache is showing as 16,108,513 bytes, or approximately 3933 4K pages. The package...
6
by: Page Horton | last post by:
I have a ASP.NET (VB) web application running. The DTS package is suppose to generates a flat file to a file path (aka: \\myStation\outputFiles\). When it runs it generates the following error on...
3
by: shorti | last post by:
running on AIX with DB2 v8.2.2 I ran across a problem with naming source files with similar names. For instance, if I have these three files: upd_startaccessingdb.sqc upd_startusingdb.sqc...
1
by: Laurence | last post by:
Hi folks, In the middle of page 231 on the book "Administration Guide - Implementation" stated - "In addition to these package privileges, the BINDADD database privilege allows users to create...
0
debasisdas
by: debasisdas | last post by:
PACKAGE WITH LOCAL FUNCTION ============================= create or replace package my_pkg as procedure my_proc(arg1 in varchar2); function my_fun(arg1 in number) return varchar2; end my_pkg;...
0
debasisdas
by: debasisdas | last post by:
The following thread contains some useful tips/sample codes regarding PACKAGES in oracle, that the forum members may find useful. A package is a collection of procedures,functions,cursors,global...
0
debasisdas
by: debasisdas | last post by:
SAMPLE PACKAGE EX#3 ==================== PACKAGE SPECIFICATION -------------------------------------------- CREATE OR REPLACE PACKAGE MYPACK AS PROCEDURE SHOWENAME(EMPID IN NUMBER); FUNCTION...
0
by: Steven Samuel Cole | last post by:
Hi Stephane, thanks for your reply! :-) I do not get any notification or warning or whatever from dpkg, all output I get when running # sudo dpkg -i python-<package name>_0.0.1-4927-1_all.deb...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.