Azure sql database how to track table schema change

So someone dropped a column in a Azure sql db. How to show the table schema before the change? Restore to a previous version is not a option as that would override everything.

sharepoint online – Creating a channel on microsoft teams with site design schema

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

database theory – What do I call a relational schema without the constraints?

It is common in db theory to define a ‘relation schema’ as consisting of a relation name, the (names of the) attributes, as well as constraints on the relation. A ‘database schema’ is then a set of such relation schemas.

An instance of the database schema consists of a finite set of tuples for each of the relations, which satisfies all of the constraints.

Now what I need is the notion of a relation schema, and sets of such without the constraints. I want to add the constraints separately, and then be able to talk about how some instance of the (constraint-less) schema satisfies the constraints or not. E.g. define ‘legal instances’ as instances that satisfy the constraints.

Is it defined like that somewhere in the literature? What are the common names for a db schema sans constraints?

PostgreSQL: How to backup only One Schema from a database and restore it to other schema having same name of database?

I have a database named "A" which has three schemas "B","C" and "D". I want to take backup of schema "C" and restore the data to Schema "B"? not sure how to do this as I am new to Postgres. pls help with commands.

schema.org – How can I add schema mark up for multiple holiday resorts?

Our client is a holiday company that offers villa accommodation at a list of different resorts in Menorca. We want to mark up the homepage for the handful of top resorts. Is it possible to mark up one page for multiple resorts do this or would we only be able to mark up one resort per page? I also can’t find a schema generator or plugin for resorts, does anyone know if there is one or would we need to write the code ourselves? Thanks

python – FastAPI: Having a dependency through Depends() and a schema refer to the same root level key without ending up with multiple body parameters

I have a situation where I want to authorize the active user against one of the values (Organization) in a FastAPI route. When an object of a particular type is being submitted, one of the keys (organization_id) should be present and the user should be verified as having access to the organization.

I’ve solved this as a dependency in the API signature to avoid having to replicate this code across all routes that needs access to this property:

def get_organization_from_body(organization_id: str = Body(None),
                               user: User = Depends(get_authenticated_user),
                               organization_service: OrganizationService = Depends(get_organization_service),
                               ) -> Organization:
    if not organization_id:
        raise HTTPException(status_code=400, detail='Missing organization_id.')

    organization = organization_service.get_organization_for_user(organization_id, user)

    if not organization:
        raise HTTPException(status_code=403, detail='Organization authorization failed.')

    return organization

This works fine, and if the API endpoint expects an organization through an organization_id key in the request, I can get the organization directly populated by introducing get_organization_from_body as a dependency in my route:

@router.post('', response_model=Bundle)
async def create_bundle((...)
                        organization: Organization = Depends(get_organization_from_body),
                        ) -> Model:
    

.. and if the user doesn’t have access to the organization, an 403 exception is raised.

However, I also want to include my actual object on the root level through a schema model. So my first attempt was to make a JSON request as:

{
  'name': generated_name,
  'organization_id': created_organization('id_key')
}

And then adding my incoming Pydantic model:

@router.post('', response_model=Bundle)
async def create_bundle(bundle: BundleCreate,
                        organization: Organization = Depends(get_organization_from_body),
                        (...)
                        ) -> BundleModel:
    (...)
    return bundle

The result is the same whether the pydantic model / schema contains organization_id as a field or not:

class BundleBase(BaseModel):
    name: str

    class Config:
        orm_mode = True


class BundleCreate(BundleBase):
    organization_id: str
    client_id: Optional(str)

.. but when I introduce my get_organization_from_body dependency, FastAPI sees that I have another dependency that refers to a Body field, and the description of the bundle object has to be moved inside a bundle key instead (so instead of “validating” the organization_id field, the JSON layout needs to change – and since I feel that organization_id is part of the bundle description, it should live there .. if possible).

The error message tells me that bundle was expected as a separate field:

{'detail': ({'loc': ('body', 'bundle'), 'msg': 'field required', 'type': 'value_error.missing'})}

And rightly so, when I move name inside a bundle key instead:

{
    'bundle': {
        'name': generated_name,
    },
    'organization_id': created_organization('id_key')
}

.. my test passes and the request is successful.

This might be slightly bike shedding, but if there’s a quick fix to work around this limitation in any way I’d be interested to find a way to both achieve validation (either through Depends() or in some alternative way without doing it explicitly in each API route function that requires that functionality) and a flat JSON layout that matches my output format closer.

security – Contained User on View – Select permission denied on object ‘table1’, database ‘Database1’, schema ‘test’

As an example, I have a database called ‘Database1’ on Azure SQL Server 12.0.2000.8
I needed to setup an account that could only access a view in the database (eg. View1).
This was achieved by the following:

CREATE USER (testuser) WITH PASSWORD 'P@ssword1!'
GO
GRANT SELECT ON (dbo).(View1) to (testuser)
GO

This worked perfectly. I was able to connect to the Database and only see the view and not the related tables.

My colleagues then utilized this method to create additional user accounts with read access to other views.

Recently the user accounts have been unable to access the views with the following error msg.

“Select permission denied on object ‘table1’, database ‘Database1’, schema ‘test'”

I have checked that there is no deny permission against the accounts.
If I grant select on the specified table (table1), the issue is resolved, however this enables the user account to view the table contents which I would like to avoid.

Any assistance in troubleshooting this would be appreciated.

google search – Schema Markup for Web Application Pages and Landing Pages

I have build a Web Application and the website is set-up like this:

  1. Landing Pages that consists of Home, Price, Features and Contact Us
  2. Web Application pages that are for logged in users and only the Login page and Register page can be accessed by Search Engine bots.

At the moment, I have the following schema microdata for all pages, including the landing pages as well as the web application pages:

<body itemscope itemtype="http://schema.org/WebApplication"">
  <meta itemprop="name" content="Awesome Education App">
  <meta itemprop="about" content="Education App for smart people.">
  <meta itemprop="applicationCategory" content="EducationApplication">
  <meta itemprop="author" content="Mr Smith">
  <meta itemprop="creator" content="Example Company">
  <meta itemprop="country" content="Australia">
  <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <meta itemprop="price" content="5.00" />
    <meta itemprop="priceCurrency" content="AUD" />
    <link itemprop="availability" href="http://schema.org/InStock" />
  </span>
  <meta itemprop="keywords" name="keywords" content="education app, etc, etc">

  <ul itemscope itemtype="http://schema.org/SiteNavigationElement">
     <li><a href="home">Home</a></li>
     <li><a href="price">Price</a></li>
     <li><a href="features">Features</a></li>
     <li><a href="contact-us">Contact Us</a></li>
     <li><a href="web-app/login">Login</a></li>
     <li><a href="web-app/register">Register</a></li>
 </ul>    
</body>

My questions are:

1) Do I have separate schema for Landing Pages and the App Pages? I mean have something like this:

Have this Schema for Landing Page, Price Page and Features page like this:

<body itemscope itemtype="http://schema.org/WebPage">
...
<body>

Have this Schema for all App Pages:

<body itemscope itemtype="http://schema.org/WebApplication">
...
<body>

2) Do I add schema for offer, about etc in each individual pages (such as: itemprop="price" in Price page and itemprop="about" in Features page) or can I have all data in every pages like my example above?

3) The App I have created is an education app. Can I use applicationCategory schema like this or is this invalid. If it is invalid, what will be the best category in this case:

<meta itemprop="applicationCategory" content="EducationApplication">

4) Can I use SiteNavigationElement with WebApplication schema type?

5) Lastly, with the SiteNavigationElement for menu items, is my example method correctly implemented or do I need add itemprop for each individual menu items?

Thank you so much for your help.

mongodb – “Document Failed Validation” what is wrong with my schema validation

I am trying to create a collection with JsonSchema (really its “BsonSchema”) validation. This is a document that I want to insert (with bogus values). Note that Id is coming from the mongo c# driver as the ObjectID via StringObjectIdGenerator.

{
  "Id": "602ff3ed562ec58cb18c37c3",
  "UserId": 2,
  "UserName": "UserName_1",
  "Password": "Password_1",
  "PasswordSalt": "InstallSchema",
  "CreatedDateUtc": "2021-02-19T17:22:50.86151Z"
}

This is one of the many schemas that I have tried to use.

{
  "bsonType": "object",
  "properties": {
    "Id": {
      "bsonType": "objectid"
    },
    "UserId": {
      "bsonType": "int"
    },
    "UserName": {
      "bsonType": ( "string", "null" )
    },
    "Password": {
      "bsonType": ( "string", "null" )
    },
    "PasswordSalt": {
      "bsonType": ( "string", "null" )
    },
    "CreatedDateUtc": {
      "bsonType": "date"
    }
  },
  "required": ( "UserId", "UserName", "Password", "PasswordSalt", "CreatedDateUtc" )
} 

When inserting the document into the collection it reports “Document failed validation” with no more specific detail. I know the document is correct, its the schema that is not, but I cant figure out what is wrong with it. I’ve tried different variations of the Id property including _id, a string type, and removing it completely, but I dont know if thats even the problem. Any ideas on how to figure this out?

Also I did try creating the collection without schema validation and the document inserts fine. Then in Compass, I ran analysis for the collection and exported what it calls a schema (a very different format from the validator schema) and the properties and types match the schema above.

FAQ schema issue for my page

I’d like to add the FAQ schema to CBD page. However, when I test it google search console I get an error telling me that there is a missing field “mainentity”. Is it something I’m doing wrong? I am using SEO Yoast but after enabling it, it is showing above error in testing.