question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
sqlalchemy-botcommented, Nov 27, 2018

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

→ 6c2a1e176086

0reactions
sqlalchemy-botcommented, Nov 27, 2018

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Read more comments on GitHub >

github_iconTop Results From Across the Web

MySQL 5.7 Reference Manual :: 12.10.8 ngram Full-Text Parser
To create a FULLTEXT index that uses the ngram parser, specify WITH PARSER ngram with CREATE TABLE , ALTER TABLE , or CREATE...
Read more >
MySQL - How to search a single character with fulltext index
Yes, it is possible to use full-text search with a single character. You should set ngram_token_size to 1. However, there are some problems...
Read more >
Planning to support Full-text index with Ngram parser? - Help
Hi, When will MemSQL's full-text search (FTS) support parsers like MySQL's ngram? Creating a full-text index using the ngram parser for ...
Read more >
MySQL and MariaDB — SQLAlchemy 2.0 Documentation
MySQL / MariaDB Unique Constraints and Reflection ... CREATE FULLTEXT INDEX in MySQL also supports a “WITH PARSER” option.
Read more >
nGram full text search (by 이성욱) - SlideShare
(https://bugs.mysql.com/bug.php?id=85875) Stopword handling for ngram parser is a little bit weird. Ngram fulltext parser does not index all ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found