saran
saran

Reputation: 11

Dql query to find all the attributes

I need a full dql query to find all the attributes (single and Repeating) for the documents. I haven't tried any query.

Upvotes: 0

Views: 6610

Answers (2)

Henning Winter
Henning Winter

Reputation: 46

You could also use a "describe " to get information.

You should also investigate the views underneath if you're querying from non-dql application.

Upvotes: 1

cgrim
cgrim

Reputation: 5031

You can select all attributes for object type using this query:

SELECT DISTINCT attr_name, attr_type, attr_repeating, attr_length FROM dm_type WHERE name = 'dm_document' ORDER BY attr_name

Where you replace dm_document by your target object type name and

  • attr_name contains attribute name
  • attr_type defines attribute type (0 - Boolean, 1 - Integer, 2 - String, 3 - ID, 4 - Time, 5 - Double)
  • attr_repeating indicates whether the attribute is repeating or not
  • attr_length defines size of String based attributes

If you want only attributes for that object type and not ones inherited from super type then you can select them by this query:

SELECT DISTINCT r_object_id, attr_name, attr_type, attr_repeating, attr_length, i_position, start_pos FROM dm_type WHERE name = 'dm_document' AND i_position < -start_pos ORDER BY attr_name ENABLE(ROW_BASED)

Upvotes: 3

Related Questions