Hi, i need a result of all attributes including the properties when we right click the documents and see - d

I want all the mandatory single and repeating attributes and also the properties when we see by right click the documents for the Archive cabinet. I tried the below query in Oracle SQL Developer :
select r_object_id, object_name, r_object_type, title, subject,
r_creation_date, r_modify_date, r_modifier, a_content_type,
i_contents_id, i_cabinet_id,owner_name,i_chronicle_id,authors,keywords,
i_folder_id,r_version_label
FROM IPEDMS.dm_sysobject_s, IPEDMS.dm_sysobject_r
WHERE IPEDMS.dm_sysobject_s.r_object_id = IPEDMS.dm_sysobject_r.r_object_id
and r_object_id in (select * from ip_indexcard_doc_s);
Please let me know the correct query.
Note: in the ip_indexcard_doc_s table only i found those properties when we right click the documeents under archive.

You need to look in the dm_type_xxx tables along with some other tables.
Easiest way to find out is to install the dqMan from FME and work your way though that. It's free and very good for working with docbases.
And as stated by #cgrim above, you should consider to use DQL instead unless you really understand the Documentum object model.

Related

Bigquery struct introspection

Is there a way to get the element types of a struct? For example something along the lines of:
SELECT #TYPE(structField.y)
SELECT #TYPE(structField)
...etc
Is that possible to do? The closest I can find is via the query editor and the web call it makes to validate a query:
As I mentioned already in comments - one of the option is to mimic same very Dry Run call with query built in such a way that it will fail with exact error message that will give you the info you are looking for. Obviously this assumes your use case can be implemented in whatever scripting language you prefer. Should be relatively easy to do.
Meantime, I was looking for making this within the SQL Query.
Below is the example of another option.
It is limited to below types, which might fit or not into your particular use case
object, array, string, number, boolean, null
So example is
select
s.birthdate, json_type(to_json(s.birthdate)),
s.country, json_type(to_json(s.country)),
s.age, json_type(to_json(s.age)),
s.weight, json_type(to_json(s.weight)),
s.is_this, json_type(to_json(s.is_this)),
from (
select struct(date '2022-01-01' as birthdate, 'UA' as country, 1 as age, 2.5 as weight, true as is_this) s
)
with output
You can try the below approach.
SELECT COLUMN_NAME, DATA_TYPE
FROM `your-project.your-dataset.INFORMATION_SCHEMA.COLUMNS`
WHERE TABLE_NAME = 'your-table-name'
AND COLUMN_NAME = 'your-struct-column-name'
ORDER BY ORDINAL_POSITION
You can check this documentation for more details using INFORMATION_SCHEMA for BigQuery.
Below is the screenshot of my testing.
DATA:
RESULT USING THE ABOVE SYNTAX:

How to change a database name in a query via a URL in power bi

i am trying to change my database name in my advanced editor query in power bi. I know i can create parameters with in the power bi desktop app and pass the different database with in it. I have done this and it works fine.
But what i am trying to do is when i give a user a link for example
https://app.powerbi.com/groups/me/reports/DataSource="PowerBi_1"
how do i get the datasource name which is "PowerBi_1" and pass it into my advanced editor query which looks as follows
let
Source = Sql.Database(".", "PowerBi_2", [Query="select *#(lf)from Customer"])
in
Source
so i want to replace the Powerbi_2 with PowerBi_1
is this possible?
I tried searching and the only things i could find was to add parameters from "manage parameters" which i can already do. But i need it to be passed from the URL and automatically change the data source instead of manually changing it via "edit parameters"
i know you can use filter in your URL as https://app.powerbi.com/groups/me/reports/12345678-6418-4b47-ac7c-f8ac7791a0a7?filter=Customer/PostalCode eq '15012'
but this would only work on datasets. im not sure how to do this for a database change in a query
The only thing you could try is if you have a direct query and use the new feature of binding query parameters.
https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters
Then you can set a filter with url to point to the database you need. Not sure how it would work - haven't tried it myself.
To expand on the idea a bit - you would need a table with database names in it. Then you would bind database column of that table to your query parameter and finally, use your url to set appropriate filter on this new table.
EDIT:
Scratch that, in the article I linked to, it says that direct query T-SQL is not supported. But if they were ;)...

DynamoDB Query with multiple tags

I am rather new to DynamoDB and currently we are thinking about migrating an existing project to a serverless application using DynamoDB where we want to adapt the following setup from a RDMS database:
Tables:
Projects (ProjectID)
Files (FileID, ProjectID, Filename)
Tags (FileID, Tag)
We want to make a query with DynamoDB to fetch all Files for a specific Project (by ProjectID) with one or multiple Tags (by Tag). In an RDMS this query would be simple with something like:
SELECT * FROM Files JOIN Tags ON Tags.FileID = Files.FileID WHERE Files.ProjectID = ?PROJECT AND Tags.Tag = ?TAG_1 OR ?TAG_2 ...
At the moment, we have the following DynamoDB setup (but it can still be changed):
Projects (ProjectID [HashKey], ...)
Files (ProjectID [HashKey], FileID [RangeKey], ...)
Please also consider that the number of project entries is huge (between 1000 - 30000) and also the number of files for each project (is between 50 and 100.000) and the query should be really fast.
How can this be achieved using DynamoDB-query, best without using filter expressions since they are applied after data selection? It would be perfect if the table Files could have a StringSet Tags as column but I guess that this cannot be used for an efficient DynamoDB-query (so without using DynamoDB-scan) since DynamoDB-indices can only be of type String, Binary and Number and not of type StringSet? Is this maybe an applicable use case for the Global Secondary Index (GSI)?
A bit late, just saw this question referenced from another one.
I guess you've went and solved it something like this?
DynamoDB tables
Projects (ProjectID [HashKey], ...)
Files (ProjectID [HashKey], FileID [RangeKey], ...)
Tags (Tag [HashKey], FileID [RangeKey], ProjectID [LSI Sort Key])
On the FileTags, you need the FileID to make the primary key unique, but you can add the ProjectID as a sort key for a Local Secondary Index, so you can search on Tag + ProjectID.
It's some sort of Data Denormalization, but that's what it takes to go NoSQL :-( . E.g. if your File would be switched to another Project, you'll need to update the ProjectID not only on the File, but also on all the Tags.
The question is almost three years old, but it's still in the Google result. So if anybody else lands here, maybe the following page from DynamoDB docs can help. Just found it myself and didn't try it yet, but it looks promising. Seems to be newer than the other replies here and shows a nice approach to solve the problem.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-adjacency-graphs.html

Verify the structure of a database? (SQLite in C++ / Qt)

I was wondering what the "best" way to verify the structure of my database is with SQLite in Qt / C++. I'm using SQLite so there is a file which contains my database, and I want to make sure that, when launching the program, the database is structured the way it should be- i.e., it has X tables each with their own Y columns, appropriately named, etc. Could someone point my in the right direction? Thanks so much!
You can get a list of all the tables in the database with this query:
select tbl_name from sqlite_master;
And then for each table returned, run this query to get column information
pragma table_info(my_table);
For the pragma, each row of the result set will contain: a column index, the column name, the column's type affinity, whether the column may be NULL, and the column's default value.
(I'm assuming here that you know how to run SQL queries against your database in the SQLite C interface.)
If you have QT and thus QtSql at hand, you can also use the QSqlDatabase::tables() (API doc) method to get the tables and QSqlDatabase::record(tablename) to get the field names. It can also give you the primary key(s), but for further details you will have to follow pkh's advice to use the table_info pragma.

WQL SELECT with optional column

I need to make a query like this:
SELECT PNPDeviceID FROM Win32_NetworkAdapter WHERE AdapterTypeId = 0
Trouble is, the AdapterTypeId column isn't always present. In this case, I just want everything, like so:
SELECT PNPDeviceID FROM Win32_NetworkAdapter
My WQL/SQL knowledge is extremely limited. Can anybody tell me how to do this in a single query?
EDIT:
A bit more background seems to be required: I am querying Windows for device information using WMI, which uses an SQL-like syntax. So, in my example, I am querying for network adapters that have an AdapterTypeId of 0.
That column is not always present however, meaning that if I enumerate through the returned values then "AdapterTypeId" is not listed.
EDIT 2:
Changed SQL to WQL; apparantly this is more correct.
I am assuming you mean the underlying schema is unreliable.
This is a highly unconventional situation. I suggest that you resolve the issue that is causing the column to not always be present, because to have the schema changing dynamically underneath your application is potentially (almost certainly) disastrous.
Update:
OK, so WQL lets you query objects with a SQL-like syntax but, unlike SQL, the schema can change underneath your feet. This is a classic example of a leaky abstraction, and I now hate WQL without ever having used it :).
Since the available properties are in flux, I am guessing that WQL provides a way to enumerate the properties for a given adapter. Do this, and choose which query to run depending upon the results.
After some Googling, there is an example here, which shows how to enumerate through the available properties. You can use this to determine if AdapterTypeId exists or not.
SELECT PNPDeviceID FROM Win32_NetworkAdapter WHERE AdapterTypeId = {yourDesire} OR AdapterTypeId IS NULL
I assume that you mean that this field is missing from the table.
Do you know before submitting the query if this field exists?
If yes then just create SQL dynamically, otherwise It think you will get syntax error in case of missing field
This is not an SQL question. SQL does not contemplate records with varying schemas in a single table source. Instead (as you mention) this is a different system using an "SQL-like" syntax. You'll have better luck if you recast the question using the actual product that you're trying to query, and information how that product deals with variable record structures is probably discussed in the documentation.