- attached firebird.diff
[PATCH] firebird tests fail when using has_table or has_sequence
(original reporter: randall) At svn 6292, most of these tests fail.
nosetests test.engine.test_reflection:ComponentReflectionTest --dburi=firebird://test:test@dbhost1/var/lib/firebird/2.0/data/test.gdb
I traced it back to calls to has_table and has_sequence. I'm using Firebird classic 2.0. Apparently for my setup, the SELECT 1 without a column alias was returning an empty string, which caused denormalize_name to barf. I've attached a patch which uses aliases and all tests pass now for me.
Comments (11)
-
Account Deleted -
Account Deleted - changed title to [PATCH] firebird tests fail when using has_table or has_sequence
(original author: randall) I remembered my login so I could add PATCH to the title. Ha!
-
Uhm, even if I agree that the proposed patch is innoquous, I fail to see the relation between how the field is labelled and the
denormalize_name
barf.The function is applied only to the "incoming" argument (that is, either to the table name or the sequence name), and the affected methods just check whether the query returns a row or not:
tblqry = """ SELECT 1 FROM rdb$database WHERE EXISTS (SELECT rdb$relation_name FROM rdb$relations WHERE rdb$relation_name=?) """ c = connection.execute(tblqry, [self.denormalize_name(table_name)](self.denormalize_name(table_name))) return c.first() is not None
There must be something else going wrong here, as the test suite you mention does work ok for me:
svn-0.6 $ ./rt test.engine.test_reflection:ComponentReflectionTest .'test_get_columns_with_schema' unsupported on DB implementation 'firebird+kinterbasdb': no schema support ..'test_get_foreign_keys_with_schema' unsupported on DB implementation 'firebird+kinterbasdb': no schema support ..'test_get_indexes_with_schema' unsupported on DB implementation 'firebird+kinterbasdb': no schema support ...'test_get_schema_names' unsupported on DB implementation 'firebird+kinterbasdb': no schema support ..'test_get_table_names_with_schema' unsupported on DB implementation 'firebird+kinterbasdb': no schema support ..'test_get_table_oid_with_schema' unsupported on DB implementation 'firebird+kinterbasdb': no schema support ..'test_get_view_columns_with_schema' unsupported on DB implementation 'firebird+kinterbasdb': no schema support ..'test_get_view_definition_with_schema' unsupported on DB implementation 'firebird+kinterbasdb': no schema support ..'test_get_view_names_with_schema' unsupported on DB implementation 'firebird+kinterbasdb': no schema support . ---------------------------------------------------------------------- Ran 19 tests in 0.698s OK
-
repo owner - changed milestone to 0.6.xx
-
repo owner if you can post what error was raised when the label wasn't present that would shed light on what's happening here.
-
Account Deleted Replying to zzzeek:
if you can post what error was raised when the label wasn't present that would shed light on what's happening here. Here's the error:
File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/engine/base.py", line 1972, in _init_metadata self._metadata = ResultMetaData(self, metadata) File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/engine/base.py", line 1866, in __init__ colname = dialect.normalize_name(colname) File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/dialects/firebird/base.py", line 343, in normalize_name not self.identifier_preparer._requires_quotes(name.lower()): File "/usr/lib/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/sql/compiler.py", line 1507, in _requires_quotes or value[0](0) in self.illegal_initial_characters IndexError: string index out of range
Here's the isql results: for firebird 2.0.5 (column doesn't have a name):
SQL> select 1 from rdb$database; ============ 1
for firebird 2.1 (name appeared):
SQL> select 1 from rdb$database; CONSTANT ============ 1
cursor.description returns empty string ('') and indexing fails.
-
Account Deleted Can someone add nikita.vetoshkin@gmail.com to cc (previous message is mine)?
-
repo owner - changed watchers to nikita.vetoshkin@gmail.com
-
repo owner - changed milestone to 0.6.1
that makes a lot of sense. someone should commit the patch.
-
repo owner - changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.6.1 (automated comment)
- Log in to comment
adds alias to column results for has_table and has_sequence