python - Applying a function to a column in SQL to create a new column -


i have function in python apply column of data in sql table

from nltk import regexptokenizer import string  def get_word_count(doc):  tokenizer = regexptokenizer(r'\w+')  doc_tokens = tokenizer.tokenize(doc) counted_words = {}  word in doc_tokens:     try:         counted_words[word] = int(counted_words[word]) + 1     except keyerror:         counted_words[word] = int(1)  return counted_words  pyrattle.eq.postgres.models import *  session = session() q = session.query(rawdocument)  in q:     get_word_count(i)     new_ob = ten_q()     new_ob.tf_dict_phrases = my_tf_dict     session.add(new_ob)     session.commit() 

i plan use sqlalchemy perform this, not know how go it.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -