On Fri, Nov 3, 2017 at 6:03 AM, su-sa <sachdeva.sugandh...@gmail.com> wrote: > Hi everyone, > > I am testing hana with sqlalchemy and the all the ComponentReflectionTests > show an error. The traceback for test_varchar_reflection is as follows: > > ERROR at setup of > ComponentReflectionTest_hana+hdbcli.test_varchar_reflection > Traceback (most recent call last): > File "build\bdist.win-amd64\egg\sqlalchemy\testing\fixtures.py", line 83, > in setup_class > cls._setup_once_tables() > File "build\bdist.win-amd64\egg\sqlalchemy\testing\fixtures.py", line 112, > in _setup_once_tables > cls.metadata.create_all(cls.bind) > File "build\bdist.win-amd64\egg\sqlalchemy\sql\schema.py", line 3992, in > create_all > tables=tables) > File "build\bdist.win-amd64\egg\sqlalchemy\engine\base.py", line 1940, in > _run_visitor > conn._run_visitor(visitorcallable, element, **kwargs) > File "build\bdist.win-amd64\egg\sqlalchemy\engine\base.py", line 1549, in > _run_visitor > **kwargs).traverse_single(element) > File "build\bdist.win-amd64\egg\sqlalchemy\sql\visitors.py", line 121, in > traverse_single > return meth(obj, **kw) > File "build\bdist.win-amd64\egg\sqlalchemy\sql\ddl.py", line 757, in > visit_metadata > _is_metadata_operation=True) > File "build\bdist.win-amd64\egg\sqlalchemy\sql\visitors.py", line 121, in > traverse_single > return meth(obj, **kw) > File "build\bdist.win-amd64\egg\sqlalchemy\sql\ddl.py", line 791, in > visit_table > include_foreign_key_constraints=include_foreign_key_constraints > File "build\bdist.win-amd64\egg\sqlalchemy\engine\base.py", line 948, in > execute > return meth(self, multiparams, params) > File "build\bdist.win-amd64\egg\sqlalchemy\sql\ddl.py", line 68, in > _execute_on_connection > return connection._execute_ddl(self, multiparams, params) > File "build\bdist.win-amd64\egg\sqlalchemy\engine\base.py", line 1009, in > _execute_ddl > compiled > File "build\bdist.win-amd64\egg\sqlalchemy\engine\base.py", line 1200, in > _execute_context > context) > File "build\bdist.win-amd64\egg\sqlalchemy\engine\base.py", line 1413, in > _handle_dbapi_exception > exc_info > File "build\bdist.win-amd64\egg\sqlalchemy\util\compat.py", line 203, in > raise_from_cause > reraise(type(exception), exception, tb=exc_tb, cause=cause) > File "build\bdist.win-amd64\egg\sqlalchemy\engine\base.py", line 1193, in > _execute_context > context) > File "build\bdist.win-amd64\egg\sqlalchemy\engine\default.py", line 507, > in do_execute > cursor.execute(statement, parameters) > File "C:\Python27\Lib\site-packages\hdbcli\dbapi.py", line 383, in execute > ret = self.__execute(operation, parameters) > File "C:\Python27\Lib\site-packages\hdbcli\dbapi.py", line 254, in > __execute > ret = self.__cursor.execute(operation, parameters=parameters, > iscall=iscall, scrollable=self._scrollable) > DBAPIError: (hdbcli.dbapi.Error) (365, 'no matching primary key for this > column list: line 2 col 1 (at pos 1)') [SQL: u'\nCREATE TABLE > email_addresses (\n\taddress_id INTEGER NOT NULL, \n\tremote_user_id > INTEGER, \n\temail_address VARCHAR(20), \n\tCONSTRAINT email_ad_pk PRIMARY > KEY (address_id), \n\tFOREIGN KEY(remote_user_id) REFERENCES users > (user_id)\n)\n\n'] > > Does one manually have to create some tables for this test? Or can this be a > Problem of the hana Driver dpabi? Are there some tables or Schemas that must > already exist in the database? Please excuse me if thats a very Basic > question. If I am not wrong, the test isnt even getting executed since the > Setup Fails, but what could I be doing wrong?
So I don't know anything about the "hana" database and I'm not sure what this error means, however if it means there is no "users.user_id" primary key for the referenced "users" table, that table should be there and a CREATE statement would have been emitted for it before the CREATE for the email_addresses table. *Unless* a "users" table already existed in the database. Does the "hana" database have some fixed table called "users", or had the test suite run previously and perhaps a previous "users" table was still present? > > Wishes, > S > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > 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 https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.