database-metadata

How to list tables in their dependency order (based on foreign keys)?

三世轮回 提交于 2020-06-24 13:53:07
问题 This question was originally asked by @PrateekGupta Background @PrateekGupta wanted to perform bulk insert operation on multiple tables. The tables have foreign key relationships between themselves. If an INSERT operation is done on a table with a foreign key before the referenced table is being inserted to, the operation might fail due to violation of the foreign key. Requirement Produce a list of tables within a database ordered according to their dependencies. Tables with no dependencies

NULL values for referential_constraints.unique_constraint_* columns in information schema

风流意气都作罢 提交于 2020-05-09 06:47:29
问题 In Postgres 10 I have declared the following: create table test_abc ( pk integer not null, id integer not NULL, id2 integer not null, PRIMARY KEY (pk) ); CREATE UNIQUE INDEX test_abc_ids ON test_abc(id,id2); And then a second table with a FK referencing the first: create table test_def ( id integer not null, abc_id integer, abc_id2 integer, PRIMARY KEY (id), FOREIGN KEY (abc_id,abc_id2) references test_abc(id,id2) ); Now consider the output of this query: SELECT unique_constraint_catalog,

JDBC with Spring slow metadata fetch Oracle

帅比萌擦擦* 提交于 2020-01-13 10:08:09
问题 I am using the Spring JdbcUtils.extractDatabaseMetaData() method to analyze the database. The function calls a callback and hands over a DatabaseMetaData object. This object provides the getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) . I call it like this getColumns("",TABLE_OWNER_USERNAME,null,null) and get 400 columns as a result. These are exactly the results that I want, but the request takes over 1 minute. Can I somehow optimize this

How to find out when data was inserted to Postgres?

主宰稳场 提交于 2020-01-12 14:11:35
问题 I have inherited an existing Postgres database full of data. Most of the data has a 'created_date' column value. Some of the earlier data was inserted before this was being tracked. Is there a Postgres metadata table hidden away somewhere that tracks when INSERT queries were done? 回答1: Postgres 9.5 or later You can enable track_commit_timestamp in postgresql.conf (and restart) to start tracking commit timestamps. Then you can get a timestamp for your xmin . Related answer: Atomically set

How to find out when data was inserted to Postgres?

丶灬走出姿态 提交于 2020-01-12 14:11:12
问题 I have inherited an existing Postgres database full of data. Most of the data has a 'created_date' column value. Some of the earlier data was inserted before this was being tracked. Is there a Postgres metadata table hidden away somewhere that tracks when INSERT queries were done? 回答1: Postgres 9.5 or later You can enable track_commit_timestamp in postgresql.conf (and restart) to start tracking commit timestamps. Then you can get a timestamp for your xmin . Related answer: Atomically set

How can I search through a SQL Server database schema to find StoredProcs with a specified set of args?

≡放荡痞女 提交于 2019-12-25 07:39:48
问题 I am trying to deduce which Stored Proc is used to return a specific set of data. The challenge is that the database has hundreds of Stored Procs. Is there a way I can query the schema to locate all StoredProcs that have parameters named, for instance: Unit Member BegDate EndDate ...or, barring that, find SPs that take four args? That would narrow things down a bit and ameliorate matters. 回答1: All of the information you want to find about stored procedures, you can find in tables like

.metadata folder missing on Mac showing up fine on PC

烂漫一生 提交于 2019-12-25 04:38:30
问题 I went to an id tech camp recently and they gave us a USB with all our work but it was on a PC so I was trying to get it on my Mac and then it says file not found so I check the folders the .metadata is not there so I use my dad's PC and it's there. Is there a way I can get it on my mac.i need my .project file to open it but it is not showing up on my Mac is there any other besides getting a PC please I would really appreciate it 回答1: Files that start with a dot are hidden on Unix/Linux

Why Spring Batch reads metadata tables from MASTER and not from User defined Schema?

落爺英雄遲暮 提交于 2019-12-25 00:11:48
问题 I have a spring boot batch application. In application.properties, i specify my datasource details as follows spring.datasource.url=jdbc:jtds:sqlserver://1*.2**.6*.25:14** spring.datasource.database=MYDB_DEV spring.datasource.username=username spring.datasource.password=password The problem is, when i run the batch job, all user defined tables are taken from the MYDB_DEV. But Metadata tables like BATCH_JOB_EXECUTION, BATCH_JOB_EXECUTION_CONTEXT are taken from the MASTER schema even though i

Is there a way to represent relationship between a tuple and to a table in E-R diagram?

我是研究僧i 提交于 2019-12-24 15:53:02
问题 I know this might sound a bit ridiculous, but I got a doubt that if we can represent relationship between two tables, how the two table's data is related, is there a way to represent relationship like, each registered user has a seperate pagelikes table. To make it more clear about my doubt, let me explain in this way, students enrolling for a few courses, say c, c++, java or others. Then, we can say: Student -(enrols for)- courses which means that student x can register for courses like c, c

Entity Framework entity is not in DataSpace.OSpace (_workspace.GetItemCollection(DataSpace.OSpace)) but is in DataSpace.CSpace

浪尽此生 提交于 2019-12-23 06:58:10
问题 I have been mucking around with XML s for entity Framework. I tried to create a type of entity that could have properties injected at runtime, First I created DynamicEntity object that is dynamic public class DynamicEntity : DynamicObject { Dictionary<string, object> dynamicMembers = new Dictionary<string, object>(); public override bool TrySetMember(SetMemberBinder binder, object value) { dynamicMembers[binder.Name] = value; return true; } public override bool TryGetMember(GetMemberBinder