python - marking columns in sqlalchemy tables -


I want to add a custom attribute for the column "Searchable" to a sqlalchemy model. Its purpose is to only extract the data for these columns (using the ModelFoo.__ table __ column) and put the data in Solar. What is a way to mark some columns using custom attributes? Class ModelFoo (AppBase): __tablename__ = 'foo' id = column ("id", integer, primary_key = true, autoincrement = true =) OS = column (string, faucet = false , Searchable = true) platform = column (string, searchable = true)

By default, I get the following error when I am above:

  Sqlalchemy.exc.ArgumentError: Unknown argument passed to column: ['searchable']  

I'm just looking for a common way to add "Search" in columns Soller, these pins A: base with non-members. Table for table. Properties (): Keys = [key] in table.column for key [table (key) key .searchable] solr.add (session.query (* keys) .all ())

In the above code, I'm looking for some low resolution or "key" option. "To work. Hope this question clarifies.

I put it in a different model Resolved using the attribute:

<(String, fable = false) Forums = column (string) For Search_cols = ["os", "value"], list v (base._decl_class_registry.items ( ): If (hattrr (v, "search_cols")): cols = [getattr (v, val) for val] in v.search_cols query = sess.query (* cols) solr.add (query.all) )

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -