Errr: Conflicting schema


#1

I have created a table using record/save API, The table has a column with text type. the value of the column is greater then 256, so its getting truncated. So what i did was i altered the table manually through pg admin. And then when i try to save another record. it fails with following error

{'error': {'code': 114, 'message': 'conflicting schema {TypeUnknown  {0 <nil>} character varying(512)} => {TypeString  {0 <nil>} }', 'name': 'IncompatibleSchema'}}

is there something that should be done in skygear for this to work ?


#2

#3

@Priyanka_Navgire In PostgreSQL there is no length limit for text type, so the data should not be truncated. I tried using skygear js sdk to save record and I am able to save value which is longer than 256. Which SDK are you using? or would you mind providing the code snippet that can reproduce the problem?

For the conflicting schema error, it is because the db schema is changed. We don’t suggest changing the column type in db directly since that will cause the schema conflict in skygear server.


#4

This is the actual token which i am saving to data base
AQXapuhccbF2bM5ZA-j01bP0NVu2shU4BL6dnM3gVrb6dmzHP_Z1j1IUllFlJx0nZSi_D7i2sX3LV8Wz5pdWJW_C_LtrgdR1Te0FuCA9MBChR7gk-js5qfXtf0eeyjTnD1g7gqD3P3aL4IYwgDmMR8wpFbReRRt0abL2f1Sz3ZRM3M3L5QfWuHeyKjEVZcasYSUAeVwBoYqw4mn5AkRpWzkj7yK6XAZRGV252U64ghl_pEoHvhbsx46yioYjuTIwnmn1rhfoFkIAb6U8xdJAwFlzumvtTeIMQDHQsgMIdZkof0QoYrRGyt7AaJBKXOytTvAKHxOAtEpWTUYFbYHf0VISr4tz_g

This is what i am getting when i read it
AQXapuhccbF2bM5ZA-j01bP0NVu2shU4BL6dnM3gVrb6dmzHP_Z1j1IUllFlJx0nZSi_D7i2sX3LV8Wz5pdWJW_C_LtrgdR1Te0FuCA9MBChR7gk-js5qfXtf0eeyjTnD1g7gqD3P3aL4IYwgDmMR8wpFbReRRt0abL2f1Sz3ZRM3M3L5QfWuHeyKjEVZcasYSUAeVwBoYqw4mn5AkRpWzkj7yK6XAZRGV252U64ghl_pEoHvhbsx46yioYjuTIw

And this is being done through py-skygear


#5

@Priyanka_Navgire Would you mind showing me how you save the record in py-skygear? :slight_smile: Thanks!


#6
user_info = user_response
	payload_session = {"access-token": user_info['result']['access_token'],
	"action":"record:save",
	"api_key": SKYGEAR_API_KEY, 
	"database_id":"_public", 
	"records": [{
		"linkedin_token": accessToken.access_token,
		"user_id":user_info['result']['user_id'],
		"_access": None,
		"_id": "user_session_token/" + user_info['result']['user_id']
	}]	}

	print(json.dumps(payload_session))
	response = requests.post(BASE_URL + "record/save", data =json.dumps(payload_session), headers = { "Content-Type": "application/json", "X-Skygear-API-Key":SKYGEAR_API_KEY, "X-Skygear-Access-Token":user_info['result']['access_token']}).json()

	print("\n\n")
	print(response)
	print("\n\n")

#7

@Priyanka_Navgire Just tried your code in my environment (skygear cloud), I can save the full token which are not truncated. May I know are you using skygear cloud or self deployment?