Category : cx-oracle

I’ve got class in models: class Region(models.Model): region_id=models.AutoField(primary_key=True,db_column="region_id") region_name=models.CharField(max_length=4000,blank=True,db_column="region_name") def __str__(self): return f"region_id={self.region_id}, region_name={self.region_name}" class Meta: db_table = "regions" Now I’m trying to query database from shell: python manage.py shell >>>s=Region.objects.all() >>>s When I’m connected to PostgreSQL everything is fine, but when I connect to Oracle (has same table) I’m getting "cx_Oracle.DatabaseError: ORA-00933: SQL command ..

Read more

Happy new year everyone! I’m currently struggling with ETL performance issues as I’m trying to write larger Pandas DataFrames (1-2 mio rows, 150 columns) into an Oracle data base. Even for just 1000 rows, Panda’s default to_sql() method runs well over 2 minutes (see code snippet below). My strong hypothesis is that these performance issues ..

Read more

dsn_tns = cx_Oracle.makedsn(‘myip’, ‘1521’, service_name=’myservicename’) connection = cx_Oracle.connect(user=’username’, password=’passwd’, dsn=dsn_tns) cursor = connection.cursor()* cursor.execute("INSERT INTO tablename VALUES (7.4)") #above works ok cursor.execute("INSERT INTO tablename VALUES (7:4)") #above sql raise cx_Oracle.DatabaseError: ORA-00917: missing comma above code connect oracle database table and create cursor to execute sql insert query. in insert query with values 7.4 if successfully ..

Read more

I am trying to update a date type column in an Oracle table but I am getting below error: sql2 = f"""update a_table SET COMPLETION_DATE = ‘{datetime.datetime.now()}’ WHERE ID=1""" data2 = cursor.execute(sql2) cx_Oracle.DatabaseError: ORA-00933: SQL command not properly ended for information : I am using cx_Oracle module. Source: Python..

Read more

#fetching data fro oracle database through using in and out parameters of procedure in python API import cx_Oracle cx_Oracle.init_oracle_client( lib_dir="C:instantclient-basic-windows.x64-19.9.0.0.0dbruinstantclient_19_9" ) try: conn= cx_Oracle.connect(‘c##scott/[email protected]:1521/orcl’) except Exception as err: print(‘error while connecting database>>>>>>>>>>> ‘, err) else: print(conn.version) print(‘sucessfully conneted Databasen’) try: cursor = conn.cursor() refcur = conn.cursor() print(cursor) print(‘Still,Searching Data from procedure n’) data=[10,20,30] for row ..

Read more

I have dataframe that contains 26 columns. the column types are float64, int64, datetime and object. I insert this df to database. however the float64 columns unexpectedly rounded as i see in the database. ”’ query = config[‘query’][‘insert_output_query’] #query = insert into schema.table values(:1,:2,:3,…,:25,:26) db_cursor.executemany(query, df.values.tolist()) db_connection.commit() ”’ i succesfully inserted the df to database ..

Read more