-3

How do I search for a certain text pattern in column data when coding in python using the sqlite3 package?

9
  • 5
    You might find this question interesting. Commented Apr 9, 2016 at 19:52
  • Can you add an example of what you mean? Commented Apr 9, 2016 at 20:13
  • Do you mean that you can access MySQL with a sqllite3 module? This is new to me Commented Apr 9, 2016 at 20:24
  • 1
    @Pullie: Yes! .... do something like this: import sqlite3 conn = sqlite3.connect('aDB.db') c = conn.cursor() c.execute('SELECT name FROM sqlite_master WHERE type=\'table\'') #list all tables in the database print c.fetchall() c.execute('SELECT sql FROM sqlite_master WHERE type=\'table\' AND name=\'sales\'') #list columns in table 'sales' print c.fetchall() conn.close() Commented Apr 9, 2016 at 20:26
  • 1
    Why are dates allowed to be used in different formats? It would be easier to only allow dates to be one format. Commented Apr 9, 2016 at 21:05

1 Answer 1

0

From this question How do I use regex in a SQLite query?

SQLite3 supports the REGEXP operator:

WHERE x REGEXP <regex>
Sign up to request clarification or add additional context in comments.

2 Comments

If you felt that a previous answer in its entirety fully answers this question, flagging this as a duplicate might be a better approach than replicating content without bringing anything new on the table.
I already did that, I realised as soon as I posted :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.