Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError when trying to connect mysql #33

Open
hyunjun opened this issue Nov 12, 2014 · 5 comments
Open

AttributeError when trying to connect mysql #33

hyunjun opened this issue Nov 12, 2014 · 5 comments

Comments

@hyunjun
Copy link

hyunjun commented Nov 12, 2014

Python 2.7.5 (default, Oct 14 2013, 11:50:38)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from db import DB
>>> db = DB(username='my id', password='my password', hostname='internal ip', dbname='db name', dbtype="mysql")
Refreshing schema. Please wait...Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data1/program/anaconda/lib/python2.7/site-packages/db/db.py", line 794, in __init__
    self.refresh_schema(exclude_system_tables)
  File "/data1/program/anaconda/lib/python2.7/site-packages/db/db.py", line 1216, in refresh_schema
    self.tables = TableSet([Table(self.con, self._query_templates, t, tables[t]) for t in sorted(tables.keys())])
  File "/data1/program/anaconda/lib/python2.7/site-packages/db/db.py", line 261, in __init__
    foreign_key = Column(con, queries_templates, foreign_table, foreign_column, col.type)
AttributeError: 'str' object has no attribute 'type'

Any ideas?, please

@glamp
Copy link
Contributor

glamp commented Nov 12, 2014

I think there's a bug when there's a column named name

@hyunjun
Copy link
Author

hyunjun commented Nov 13, 2014

@glamp meaning I have a column named name in my table? if that, no.

@glamp
Copy link
Contributor

glamp commented Nov 13, 2014

yes.

hmmm...i'll take a look. sorry about this. any chance you could give me the schema/data you're working with?

@hyunjun
Copy link
Author

hyunjun commented Nov 14, 2014

@glamp
nothing weird I think. 3 blobs contains json dictionary made from json.dump(dict) from python.
+---------------+-------------+-----+-----+------+----------------+
| id | int(11) | NO | MUL | NULL | auto_increment |
| ppkey | int(11) | NO | PRI | NULL | |
| keyword | varchar(45) | NO | PRI | NULL | |
| represent | char(1) | NO | | N | |
| json | blob | NO | | NULL | |
| answer | blob | YES | | NULL | |
| answer_family | blob | YES | | NULL | |
| updated_at | datetime | YES | | NULL | |
+---------------+-------------+-----+-----+------+----------------+

@stefan-pdx
Copy link

I'm having a similar issue for a table with a column named count.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants