Skip to content

MySQL FULLTEXT with custom parser (e.g. ngram) fails to reflect #4219

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot
Collaborator

Migrated issue, originally created by LiQuan (@loveiset)

My existing table created with following sql

CREATE TABLE `fx_orders_items` (
  .....
  FULLTEXT KEY `ix_fulltext_oi_g_name` (`oi_g_name`) /*!50100 WITH PARSER `ngram` */ 
) ENGINE=InnoDB AUTO_INCREMENT=100018857 DEFAULT CHARSET=utf8 COMMENT=''

when I use autoload like this

Table("fx_orders_items", metadata, autoload=True)

it throws error

C:\Python27\lib\site-packages\sqlalchemy\dialects\mysql\reflection.py:57: SAWarning: Unknown schema content: u'  FULLTEXT KEY `ix_fulltext_oi_g_name` (`oi_g_name`) /*!50100 WITH PARSER `ngram` */ '
  util.warn("Unknown schema content: %r" % line)

I just debug it and found the line

FULLTEXT KEY `ix_fulltext_oi_g_name` (`oi_g_name`) /*!50100 WITH PARSER `ngram` */ 

didn't go into any of this and return None

def _parse_constraints(self, line):
        """Parse a KEY or CONSTRAINT line.

        :param line: A line of SHOW CREATE TABLE output
        """
        m = self._re_key.match(line)
        m = self._re_fk_constraint.match(line)
        m = self._re_ck_constraint.match(line)
        m = self._re_partition.match(line)

        # No match.
        return (None, line)

Activity

sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

that's only a warning, it's not a "throw". your program can continue to work correctly with this warning.

sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed title from "autoload existing mysql table throws Unknown schem" to "support refection of MySQL FULLTEXT index"
sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

there it is

sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed title from "support refection of MySQL FULLTEXT index" to "MySQL index reflection w/ comments fails"
sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

OK this is really the bug !!

sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed title from "MySQL index reflection w/ comments fails" to "MySQL FULLTEXT with custom parser (e.g. ngram) fai"
sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

add support for the whole thing, including rendering and reflection of options:

https://gerrit.sqlalchemy.org/#/c/zzzeek/sqlalchemy/+/731

sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • removed labels: low priority
sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • removed labels: bug
  • added labels: feature
sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed milestone from "1.2.x" to "1.3"
sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

Render and reflect MySQL WITH PARSER index options

Support added for the "WITH PARSER" syntax of CREATE FULLTEXT INDEX
in MySQL, using the mysql_with_parser keyword argument. Reflection
is also supported, which accommodates MySQL's special comment format
for reporting on this option as well. Additionally, the "FULLTEXT" and
"SPATIAL" index prefixes are now reflected back into the mysql_prefix
index option.

Change-Id: I0209291978125d8cee1bb5ed386d4f66578697a0
Fixes: #4219

6c2a1e1

sqlalchemy-bot

sqlalchemy-bot commented on Apr 17, 2018

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

1 remaining item

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sqlalchemy-bot

        Issue actions

          MySQL FULLTEXT with custom parser (e.g. ngram) fails to reflect · Issue #4219 · sqlalchemy/sqlalchemy