Relational-Databases | Relational Database , PostgreSQL | Object-Relational Mapping library
kandi X-RAY | Relational-Databases Summary
kandi X-RAY | Relational-Databases Summary
Data stored as row records in tables. Imagine a spreadsheet with column headers describing the contents of each column, and each row is a record. A database can contain many tables. A table can contain many rows. A row can contain many columns. Records are related to those in different tables through common columns that are present in both tables.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Relational-Databases
Relational-Databases Key Features
Relational-Databases Examples and Code Snippets
Community Discussions
Trending Discussions on Relational-Databases
QUESTION
I am using the SQL connector to capture CDC on a table that we only expose a subset of all columns on the table. The table has two unique indexes A & B on it. Neither index is marked as the PRIMARY INDEX but index A is logically the primary key in our product and what I want to use with the connector. Index B references a column we don't expose to CDC. Index B isn't truly used in our product as a unique key for the table and it is only marked UNIQUE as it is known to be unique and marking it gives us a performance benefit.
This seems to be resulting in the error below. I've tried using the message.key.columns
option on the connector to specify index A as the key for this table and hopefully ignore index B. However, the connector seems to still want to do something with index B
- How can I work around this situation?
- For my own understanding, why does the connector care about indexes that reference columns not exposed by CDC?
- For my own understanding, why does the connector care about any index besides what is configured on the CDC table i.e. see CDC.change_tables.index_name documentation
ANSWER
Answered 2021-Jun-14 at 17:35One of the contributors to Debezium seems to affirm this is a product bug https://gitter.im/debezium/user?at=60b8e96778e1d6477d7f40b5. I have created an issue https://issues.redhat.com/browse/DBZ-3597.
Edit:
A PR was published and approved to fix the issue. The fix is in the current 1.6 beta snapshot build.
There is a possible workaround. The names of indices are the key to the problem. It seems they are processed in alphabetical order. Only the first one is taken into consideration so if you can rename your indices to have the one with keys first then you should get unblocked.
QUESTION
We are using system-versioned temporal table in our Entity Framework Core application. This works really well but we are experiencing problems when creating a test.
I have been following this guide using SQLite in-memory databases to test an EF Core application from Microsoft.
https://docs.microsoft.com/en-us/ef/core/testing/sqlite#using-sqlite-in-memory-databases
The problem is that Sqlite
will throw an exception for SysStartTime
. This is expected since the property is marked as prop.ValueGenerated = Microsoft.EntityFrameworkCore.Metadata.ValueGenerated.OnAddOrUpdate;
in DbContext
and is normally handled by Sql Server. Is there anyway to make this work in SQLite?
SqliteException: SQLite Error 19: 'NOT NULL constraint failed: User.SysStartTime'.
User:
...ANSWER
Answered 2021-Jan-12 at 00:19Solved it like this in protected override void OnModelCreating(ModelBuilder modelBuilder)
:
QUESTION
I've written a function that requests some data from an API and dumps it in a Storage Account. Then I'm accesing the data in Azure SQL DB using this method. Everything works as intended, but I'm left with the following looking table:
...ANSWER
Answered 2021-May-27 at 14:31If you wanted to put it into separate tables, you would use SCOPE_IDENTITY
to get the previous insert's ID.
Because the root object is in an array, you need to change the path to $[0]
QUESTION
I have Linq statement:
...ANSWER
Answered 2021-May-18 at 14:34Due to Deferred execution, your query on its own will not produce any SQL.
However, If you are in your debugger and you have a statement like
QUESTION
I am trying to implement fault tolerance and trying to collect a list of SQL error numbers that are considered transient. but I keep running into error numbers that have multiple documentations.
Consider error number 10053:
(1) A transport-level error has occurred when receiving results from the server
(from here)
(2) Could not convert the data value due to reasons other than sign mismatch or overflow.
(from here)
It gets weirder. Consider error number 11001:
(1) Non-NULL value successfully returned.
(2) An error has occurred while establishing a connection to the server....
Both from the same Microsoft docs page adjacent to each other.
What's going on?
...ANSWER
Answered 2021-May-10 at 07:35As @Jeroen Mostert said,
Error 10053 means that an established connection has been dropped.
- An established connection was aborted by the software in your host machine.
- The TCP/IP Connection was aborted by Windows. This was possibly due to a data transmission timeout or protocol error.
- The virtual circuit was terminated due to a time-out or other failure. The application should close the socket as it is no longer usable.
SQL server error 11001 occurs when the SQL Server can't be found on Network. This happens if the IP address is not reachable or the TCP port number is either not open or is not the correct port number or is blocked by a firewall
- This error mainly occurs when the SQL Server client can't connect to the server. This may happen when the client cannot resolve the name of the server or the name of the server is incorrect.
So we should check firewall list in Azure sql first.
QUESTION
I have a JSON object which I have declared in SQL Server like so
...ANSWER
Answered 2021-Apr-16 at 11:00One method is using 2 calls to OPENJSON
:
QUESTION
ANSWER
Answered 2021-Mar-30 at 00:45Updates:
Looking at this more, you will need the attributes value of the relation object. Problem is, the attribute constants are bitwise and a bit elusive in the documentation. A value of 0 is the default you see and the rest have to be added up.
So this is what you can do:
Create a relationship in your database in the way you want it (left join, right join etc) and save. Assuming northwind is your database, in a function or module:
QUESTION
A project I'm working on involves storing a string of data in a table column. The table will have other columns relevant to the records. We decided to store the string data column using JSON.
From the table, a view will parse the JSON column into separate columns. The view will also have columns derived from the other main table columns. The data from the view is then used to populate parts of a document through SSRS.
When loading data into the main table, I need to utilize separate tables for deriving the other column values and the JSON column. I decided to use common table expressions for this. At the end of the query, I bring together the derived columns from the different common table expressions, including the JSON column, and insert them into the main table.
I had it almost done until I realized that when I use FOR JSON to create the JSON column, it escapes special characters. I did some research and have been trying to use the JSON_QUERY function to get around this but it's not working. Here is a simplification of the problem:
...ANSWER
Answered 2021-Mar-03 at 01:45It's quite simple:
{"Firt_Name": "Tim/"}
is valid JSON, so JSON_QUERY
can return it as is. Tim/
is not valid so needs escaping first.
Using
JSON_QUERY
withFOR JSON
JSON_QUERY
returns a valid JSON fragment. As a result, FOR JSON doesn't escape special characters in theJSON_QUERY
return value.If you're returning results with
FOR JSON
, and you're including data that's already in JSON format (in a column or as the result of an expression), wrap the JSON data withJSON_QUERY
without the path parameter.
Given your use case, is it not possible to pass through the JSON to where you need it and un-escape it there? OPENJSON
and JSON_VALUE
are capable of this.
QUESTION
According to MS docs DATEADD
is a deterministic function hence my function below should be deterministic too:
ANSWER
Answered 2021-Feb-21 at 21:56DATEADD
is. Implicitly converting a varchar
to a datetime
, however, is not. This is especially worse when the format you use is ambiguous for datetime
(though at least the value would be the same).
You need to explicitly convert the value with a style:
QUESTION
I would like to get alerts when certain database errors occur. For instance, if a table or stored procedure is queried against that no longer exists, I want an alert.
I've tried creating alerts for these error codes (208, 2812) but they never trigger, no doubt due to the fact that there are only a handful of error codes that are logged, according to the docs.
From sys.messages:
Error Severity Event Logged Description 208 16 No Invalid object name '%.*ls'. 2812 16 No Could not find stored procedure '%.*ls'.Is there a way to change the event logged status?
...ANSWER
Answered 2021-Feb-18 at 18:26Turns out there's a SP to do it, sp_altermessage
. Docs
exec SP_ALTERMESSAGE 208, 'WITH_LOG', 'TRUE'
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Relational-Databases
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page