I am able to access our MS SQL Server 2012 instance and create tables to my 
heart's content.

I'm using the FreeTDS driver to connect to our server with the following 
string:

def connect():
    return pyodbc.connect(
        'DRIVER={FreeTDS};SERVER=<ip_address>;'
        'DATABASE=<db_name>;UID=test;PWD=test;port=1433;'
        'TDS_Version=9.1;')
engine = sqlalchemy.create_engine('mssql://', creator=connect)
conn = engine.connect()

And am using the Cubes create_table_from_csv method to create the table 
from a CSV file as follows:

create_table_from_csv(engine,
                      "data.csv",
                      table_name=FACT_TABLE,
                      fields=[
                            ("category", "string"),
                            ("category_label", "string"),
                            ("subcategory", "string"),
                            ("subcategory_label", "string"),
                            ("line_item", "string"),
                            ("year", "integer"),
                            ("amount", "integer")],
                      create_id=True
                  )

The table is created, the data are loaded, and the permissions for my UID 
are all good to go.

However, when I try to actually see the tables, they are not accessible. 

I had been trying to get the Cubes "hello_world" example 
(http://pythonhosted.org/cubes/install.html#quick-start-or-hello-world) 
working on our remote server, and when I tried running the aggregate.py 
script, I kept getting the error that "cubes.errors.WorkspaceError: No such 
fact table 'irbd_balance'." 

I know the table is there, I have checked the permissions a zillion times, 
etc., and kept trying to tweak the cubes model, all to no avail.

Then, I thought, what if this is an SQLAlchemy issue. Looks to be. I ran 
the following script as a test:

import pyodbc
import sqlalchemy
from sqlalchemy.engine import reflection
from sqlalchemy.engine.reflection import Inspector

def connect():
    return pyodbc.connect(
'DRIVER={FreeTDS};SERVER=<ip_address>;'
'DATABASE=<db_name>;UID=test;PWD=test;port=1433;'
'TDS_Version=9.1;')
engine = sqlalchemy.create_engine('mssql://', creator=connect)
conn = engine.connect()
print conn

for row in engine.execute('select 6 * 7 as [Result];'):
    print row.Result

insp = reflection.Inspector.from_engine(engine)
table_name = 'irb_desc'
table_names = insp.get_table_names()
if table_name not in table_names:
    print 'A'

Again, I am connecting fine with the database create.engine method (that is 
'42' is printing as expected), but when I run the inspector.get_table_names 
method with the given conditional it is printing the 'A' (I have tried 
other table names in the same database to which I added 'irbd_balance,' all 
with the same result.

Any clue why I am not able to see my tables?

Thanks in advance!

Greg--






-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to