I am trying to get the schema out of a database, before applying any queries from a local SQL Server Compact Edition file (*.sdf
).
So far, I can connect to the database and perform queries when I know the schema.
I have tried two approached and both failed.
First, I try to use
import adodbapi.schema_table as DB_schema
temp2 = DB_schema.names(connection_handler)
but this fails with the following error:
raise AttributeError('no such attribute in ADO connection object as="%s"' % item)
AttributeError: no such attribute in ADO connection object as="adoConn"
(this was the easy solution from the reference guide)
Also
connection_handler.get_table_names() #doesn't work
fails...
Then, I tried
sql_query_to_get_all_table_names_from_database = "SELECT Distinct TABLE_NAME FROM information_schema.TABLES"
cursor.execute(sql_query_to_get_all_table_names_from_database)
which also fails with a slightly different message:
adodbapi.apibase.DatabaseError: (-2147352567, 'Exception occurred.', (0, u'Microsoft SQL Server Compact OLE DB Provider', u'Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.', None, 0, -2147217887), None)
Command:
SELECT Distinct TABLE_NAME FROM information_schema.TABLESParameters:
[]
The very same query works fine when it is performed on compact view.
Any ideas are more than welcome.
Is there any other approach? (I have tried odbc, SQL Server, but no luck so far)