Hi,
Is it possible to retrieve details about the database, specifically a
list of the tables in the database; and then to retrieve the columns
and their types for the tables?
Is this dependant on the database?
Thanks
Chris 5 3285
Chris Brat wrote:
Is it possible to retrieve details about the database, specifically a
list of the tables in the database; and then to retrieve the columns
and their types for the tables?
Yes.
Is this dependant on the database?
Yes.
Real databases usually store meta-data (list of tables, list of columns,
list of indexes aso...) in system tables which can be queried in the same
manner as common tables or view. Just read your database handbook...
HTH
Mathias
Hello Chris,
Is it possible to retrieve details about the database, specifically a
list of the tables in the database; and then to retrieve the columns
and their types for the tables?
Is this dependant on the database?
Yes and Yes. However some toolkits like SQLObject
( http://www.sqlobject.org/) and SQLAlchemy ( http://www.sqlalchemy.org/)
can do this work for you (IIRC).
HTH,
Miki http://pythonwise.blogspot.com/
Thanks for the great feedback.
Chris.
Chris Brat wrote:
Hi,
Is it possible to retrieve details about the database, specifically a
list of the tables in the database; and then to retrieve the columns
and their types for the tables?
Is this dependant on the database?
Thanks
Chris
If you want to know the names of the fields on a recordset, you can use
cursor.descript ion.
For example, lets say you have a connection to a MySQL database:
con = MySQLdb.connect ('localhost','r oot','','mydb')
cur = con.cursor()
cur.execute('se lect * from customers')
result = cur.fetchall()
fields = [i[0] for i in cur.description]
....
Description gives a list with information about your recordset, being
the first item the name of the field.
Hope this helps...
Luis
Chris Brat wrote:
Hi,
Is it possible to retrieve details about the database, specifically a
list of the tables in the database; and then to retrieve the columns
and their types for the tables?
Is this dependant on the database?
Thanks
Chris
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: valexena |
last post by:
In which table is Oracle database audit information stored?
--
Posted via http://dbforums.com
|
by: Michael |
last post by:
I apologize if this might be a beginner question, which is clear to
the experts. But I could not find a clear answer yet.
I have extracted a schema / user with the exp utility. I want to
import it into a schema / user of a different Oracle server. Tables
structures etc. are more or less the same. However, there are a few
ADDITIONAL COLUMNS AND TABLES in the target database (no columns or
tables have been removed though).
Can I use imp...
|
by: Mario T. Lanza |
last post by:
Greetings,
I've been working on a 3-column layout where the center column is of a
fixed width (230px wide). The center column must always be 230px and
the columns on the right/left (always the same size as eachother) must
always take up the remaining width of the browser.
I have been designing for Firefox and IE and routinely viewing the
results in both.
|
by: tranky |
last post by:
Hi....
.....i'd like to know if there's a way to write in a textbox the schema of a
database.
numbers of tables, tables name, numbers of fields, fields name and other
information like fields type, etc...
is it possible? i hope...
please help me...
thank you.
|
by: Karam Chand |
last post by:
Hello
I have been working with Access and MySQL for pretty
long time. Very simple and able to perform their jobs.
I dont need to start a flame anymore :)
I have to work with PGSQL for my companies current
project.
I have been able to setup postgresql in my rh box and
| |
by: sloan |
last post by:
Back in ADO days, it was fairly easy to get the meta data (tablenames,
columnnames , etc) .. with all that schema stuff.
I have a Access database, that I'd like to get the list of tableNames in it.
How does one get the metadata about a database thru DotNet?
Thanks.
|
by: Karthik |
last post by:
Hi,
I have been using GDI+ and Windows Media SDK to get the metadata
information for image and audio files respectively.
Just incase if someone is not clear as to what I mean by metadata
information, its the information regarding the image or audio files
like., height and width for the image.,. Title, artist, author etc for
the audio files.
|
by: dollyvishal |
last post by:
How to get constraint information for MS Access tables using Query?
|
by: Thekid |
last post by:
I've been working on a project lately that is written in python and I want to incorporate mysql into it. The python code is basically a report writing system in which every report will have it's own number such as 10-0001, 10-0002 and will contain information like first & last names, addresses, phone numbers, etc. There is also a page, if needed, for items such as televisions, brand names of items, color of items, serial numbers of items, values...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |